/* ========================================
   Loading Screen - karory.net Style (Enhanced)
   ======================================== */

/* ローディング画面のオーバーレイ */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s ease;
}

/* ローディング完了時のフェードアウト */
#loading-screen.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.05);
}

/* 画面端の青いグロー効果（アニメーション付き） */
#loading-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: inset 0 0 120px rgba(100, 150, 255, 0.35);
  pointer-events: none;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {

  0%,
  100% {
    box-shadow: inset 0 0 120px rgba(100, 150, 255, 0.35);
  }

  50% {
    box-shadow: inset 0 0 150px rgba(130, 180, 255, 0.5);
  }
}

/* ローダーコンテナ */
.loader-container {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 中央のロゴ/アイコン（パルスアニメーション） */
.loader-icon {
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  color: #333;
  animation: iconPulse 1.5s ease-in-out infinite, iconGlow 2s ease-in-out infinite;
  z-index: 10;
}

@keyframes iconPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

@keyframes iconGlow {

  0%,
  100% {
    text-shadow: 0 0 10px rgba(100, 150, 255, 0.3);
  }

  50% {
    text-shadow: 0 0 25px rgba(100, 150, 255, 0.7), 0 0 50px rgba(100, 150, 255, 0.4);
  }
}

/* ロゴ画像がある場合 */
.loader-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  animation: iconPulse 1.5s ease-in-out infinite;
}

/* スピナー（2重リング） */
.loader-spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  border: 2px solid rgba(100, 150, 255, 0.15);
  border-top-color: #333;
  border-right-color: rgba(100, 150, 255, 0.4);
  border-radius: 50%;
  animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

/* 内側のリング（同方向・少し速い） */
.loader-spinner::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 2px solid rgba(100, 150, 255, 0.1);
  border-top-color: rgba(100, 150, 255, 0.6);
  border-right-color: #666;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* パーティクル共通スタイル */
.loader-particle {
  position: absolute;
  font-size: 10px;
  color: rgba(100, 150, 255, 0.6);
  animation: float 3s ease-in-out infinite;
  pointer-events: none;
}

.loader-particle:nth-child(1) {
  top: -30px;
  left: 20px;
  animation-delay: 0s;
}

.loader-particle:nth-child(2) {
  top: -20px;
  right: 5px;
  animation-delay: 0.5s;
}

.loader-particle:nth-child(3) {
  bottom: -25px;
  left: 5px;
  animation-delay: 1s;
}

.loader-particle:nth-child(4) {
  bottom: -30px;
  right: 15px;
  animation-delay: 1.5s;
}

.loader-particle:nth-child(5) {
  top: 50%;
  left: -25px;
  animation-delay: 2s;
}

.loader-particle:nth-child(6) {
  top: 50%;
  right: -25px;
  animation-delay: 2.5s;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 0.3;
  }

  50% {
    transform: translateY(-12px) rotate(180deg) scale(1.2);
    opacity: 1;
  }
}

/* LOADINGテキスト（フェードアニメーション） */
.loader-text {
  margin-top: 35px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 6px;
  color: #555;
  text-transform: uppercase;
  animation: textFade 1.5s ease-in-out infinite;
}

@keyframes textFade {

  0%,
  100% {
    opacity: 0.6;
    letter-spacing: 6px;
  }

  50% {
    opacity: 1;
    letter-spacing: 8px;
  }
}

/* ドットアニメーション用（オプション） */
.loader-text::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75% {
    content: '...';
  }

  100% {
    content: '';
  }
}

/* プログレスバー */
.loader-progress {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 3px;
  background: rgba(100, 150, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.loader-progress-bar {
  height: 100%;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(100, 150, 255, 0.6) 30%,
      #333 50%,
      rgba(100, 150, 255, 0.6) 70%,
      transparent 100%);
  background-size: 200% 100%;
  animation: progressShine 1.2s ease-in-out infinite;
}

@keyframes progressShine {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* レスポンシブ：パーティクル非表示（小さい画面では） */
@media (max-width: 480px) {
  .loader-particle {
    display: none;
  }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .loader-container {
    width: 100px;
    height: 100px;
  }

  .loader-icon {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  .loader-spinner {
    width: 100px;
    height: 100px;
  }

  .loader-spinner::before {
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .loader-spinner::after {
    top: 18px;
    left: 18px;
    right: 18px;
    bottom: 18px;
  }

  .loader-text {
    margin-top: 30px;
    font-size: 10px;
    letter-spacing: 4px;
  }

  .loader-progress {
    width: 120px;
    bottom: 80px;
  }
}