/* =========================================
   Variables & Reset
   ========================================= */
:root {
  /* Colors */
  --color-primary: #F59E0B;
  --color-primary-hover: #D97706;
  --color-dark: #1E1B4B;
  --color-dark-light: #312E81;
  --color-bg: #F8FAFC;
  --color-text: #1E293B;
  --color-text-light: #64748B;
  --color-white: #FFFFFF;
  
  /* Fonts */
  --font-main: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Layout */
  --content-width: 1000px;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  letter-spacing: 0.05em;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: bottom;
}

ul, ol {
  list-style: none;
}

/* =========================================
   Base Layout & Utilities
   ========================================= */
.container {
  width: 90%;
  max-width: var(--content-width);
  margin: 0 auto;
}

.section {
  padding: 80px 0;
}

.section-title {
  font-family: var(--font-main);
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  color: var(--color-dark);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 3rem;
  font-weight: 500;
}

.bg-light {
  background-color: var(--color-white);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  border-radius: 50px;
  font-weight: 600;
  font-family: var(--font-main);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* =========================================
   Header
   ========================================= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.7); /* より透明度を上げる */
  backdrop-filter: blur(15px); /* ぼかしを強くしてグラスモーフィズムに */
  -webkit-backdrop-filter: blur(15px);
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05); /* 影を柔らかく */
  border-bottom: 1px solid rgba(255, 255, 255, 0.3); /* 上下のエッジを強調 */
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo a {
  display: flex;
  align-items: center;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out; /* 変形へのアニメーションも追加 */
}

.logo a:hover {
  opacity: 0.8; /* 暗くなりすぎないように調整 */
  transform: scale(1.03) translateY(-2px); /* フワッと少し拡大して上に浮く動きを追加 */
}

.logo-img {
  height: 54px; /* 約1.5倍のサイズに変更（元の36px -> 54px） */
  width: auto;
  object-fit: contain;
}

.global-nav ul {
  display: flex;
  gap: 24px;
}

.global-nav a {
  font-family: var(--font-main);
  font-weight: 600;
  color: var(--color-text);
  font-size: 1rem;
  transition: color 0.3s ease;
}

.global-nav a:hover {
  color: var(--color-primary);
}

/* Hamburger Menu styles */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 101;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--color-dark);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* メニューが開いている時のアニメーション */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
  min-height: 100vh;
  height: auto; /* 固定の高さを解除し、中身がはみ出ないように設定 */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000; /* 星空と同化させるため完全に真っ黒に */
  position: relative;
  text-align: center;
  padding: 120px 20px 60px; /* 上部にヘッダー高さ以上の余白を確実にとる */
  overflow: hidden; /* Canvasがはみ出ないように */
}

/* 背景Canvasのスタイル */
#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* クリックやホバーを邪魔しない */
  z-index: 1; /* コンテンツより背面に */
}

.hero-content {
  position: relative;
  z-index: 10;
  color: var(--color-white);
  animation: fadeIn 1s ease-out forwards;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
}

.highlight {
  color: var(--color-primary);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 2.5rem;
  opacity: 0.9;
  font-weight: 500;
}

.sp-only {
  display: none;
}

/* ヒーローセクションの動画設定 */
.hero-video-wrapper {
  margin: 30px auto 40px; /* 文字と動画の間に少し余白を確保 */
  max-width: 280px; /* 動画のサイズを微調整して画面に収まりやすく */
  /* 動画の黒い部分を透明にし、光だけを残す強力なCSSテクニック */
  mix-blend-mode: screen;
}

.hero-video {
  width: 100%;
  height: auto;
  display: block;
}

/* =========================================
   Games Section
   ========================================= */
.games-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 30px;
  /* 3D Tiltエフェクトの遠近感(パース)を設定 */
  perspective: 1000px;
}

.game-card {
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5); /* グラスモーフィズムのエッジ */
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: transform 0.1s ease-out, box-shadow 0.3s ease-out, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
  /* 3D変形の基準を中央に */
  transform-origin: center;
  /* 立体的な変形を維持 */
  transform-style: preserve-3d;
  /* JSから渡される角度を適用、初期値は0 */
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(0);
}

.game-card:hover {
  /* ホバー時は傾きに加えて少し上に浮かせ、影を濃く + 発光(Glow)効果 */
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-5px);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 0 20px rgba(245, 158, 11, 0.3); /* プライマリーカラーのGlowエフェクト */
  border-color: rgba(245, 158, 11, 0.5); /* 枠も少し光らせる */
  z-index: 10;
}

.game-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #E2E8F0;
  position: relative;
  overflow: hidden;
}

.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.game-card:hover .game-thumb img {
  transform: scale(1.05);
}

.game-info {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.game-genre {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 8px;
  background-color: rgba(245, 158, 11, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  align-self: flex-start;
}

.game-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 12px;
  line-height: 1.4;
}

.game-desc {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 24px;
  flex-grow: 1;
}

/* Hover detail enhancement */
.game-card .btn-outline {
  transform: translateY(10px);
  opacity: 0.8;
  transition: all 0.3s ease;
}

.game-card:hover .btn-outline {
  transform: translateY(0);
  opacity: 1;
  background-color: var(--color-primary);
  color: var(--color-white);
}

.game-card .btn {
  width: 100%;
}

/* =========================================
   Lessons Section
   ========================================= */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 30px;
  margin-bottom: 40px;
}

.lesson-card {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.lesson-card:hover {
  transform: translateY(-5px);
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.08),
    0 0 15px rgba(99, 102, 241, 0.2); /* サブカラー的なGlowエフェクト */
}

.lesson-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}

.lesson-title {
  font-family: var(--font-main);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 15px;
}

.lesson-desc {
  font-size: 0.95rem;
  color: var(--color-text-light);
  line-height: 1.7;
}

/* =========================================
   Contact Section
   ========================================= */
.contact-form-wrapper {
  max-width: 700px;
  margin: 0 auto;
  background-color: var(--color-white);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: var(--color-dark);
  font-size: 0.95rem;
}

.required {
  color: #EF4444; /* Alert Red */
  margin-left: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

/* カスタムセレクトボックスの矢印 */
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 1.2em;
  padding-right: 40px;
}

/* プレースホルダー状態の色を薄くする */
.form-group select:invalid {
  color: #94A3B8;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94A3B8;
}

/* Glow on focus */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: var(--color-white);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); /* Primary color glow */
}

.form-submit {
  text-align: center;
  margin-top: 10px;
}

.btn-submit {
  width: 100%;
  max-width: 300px;
  padding: 16px 32px;
  font-size: 1.1rem;
}

/* ハニーポットフィールド（bot対策 - 人間には見えない） */
.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

/* 送信結果メッセージ */
.form-message {
  margin-top: 20px;
  padding: 0;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: center;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.4s ease;
}

.form-message--visible {
  padding: 16px 20px;
  max-height: 200px;
  opacity: 1;
}

.form-message--success {
  background-color: rgba(34, 197, 94, 0.1);
  color: #15803D;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.form-message--error {
  background-color: rgba(239, 68, 68, 0.1);
  color: #DC2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  white-space: pre-line;
}

/* 送信中ボタン */
.btn-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================================
   About Section
   ========================================= */
.about-content {
  max-width: 600px;
  margin: 0 auto;
}

.about-list {
  background-color: var(--color-bg);
  border-radius: 12px;
  padding: 30px;
}

.about-item {
  display: flex;
  flex-direction: column;
  padding: 15px 0;
  border-bottom: 1px solid #E2E8F0;
}

.about-item:last-child {
  border-bottom: none;
}

.about-item dt {
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.about-item dd {
  color: var(--color-text);
  font-weight: 500;
}

.text-link {
  color: var(--color-primary);
  transition: opacity 0.3s ease;
}

.text-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* =========================================
   Footer
   ========================================= */
.footer {
  background-color: var(--color-dark);
  color: var(--color-white);
  padding: 40px 0;
  text-align: center;
}

.copyright {
  font-size: 0.8rem;
  font-family: var(--font-main);
  opacity: 0.7;
}

/* =========================================
   Animations (Reveal)
   ========================================= */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   Media Queries (Responsive)
   ========================================= */
@media (min-width: 768px) {
  .section {
    padding: 100px 0;
  }
  
  .sp-only {
    display: block;
  }

  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .lessons-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-item {
    flex-direction: row;
    align-items: center;
  }

  .about-item dt {
    width: 30%;
    margin-bottom: 0;
  }

  .about-item dd {
    width: 70%;
  }

  /* Responsive Nav for mobile */
}

@media (max-width: 767px) {
  .menu-toggle {
    display: flex;
  }

  .global-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    height: 100vh;
    background-color: var(--color-white);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: right 0.4s ease;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  }

  .global-nav.active {
    right: 0;
  }

  .global-nav ul {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }

  .global-nav a {
    font-size: 1.5rem;
  }

  .contact-form-wrapper {
    padding: 24px 20px;
  }
}
