/* 
 * Animations & Effects
 * - 星のエフェクト（タップ時）
 * - ページ遷移アニメーション
 * - ボタン押下エフェクト
 * - ポップアニメーション
 */

/* ==========================================
   Star Effect
   ========================================== */
.star-effect {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: starBurst 0.6s ease-out forwards;
}

.star-effect .star-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: starParticle 0.6s ease-out forwards;
}

@keyframes starBurst {
    0% { opacity: 1; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

@keyframes starParticle {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* SVG星アイコン */
.star-svg {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes starPop {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    60% { transform: scale(1.2) rotate(180deg); opacity: 1; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

/* ==========================================
   Page Transitions
   ========================================== */
.page-enter {
    animation: pageEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.page-exit {
    animation: pageExit 0.3s ease-in forwards;
}

@keyframes pageExit {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

/* ==========================================
   Button Effects
   ========================================== */
/* リップルエフェクト */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to { transform: scale(4); opacity: 0; }
}

/* ボタンホバー時のバウンス */
.btn-bounce:hover {
    animation: btnBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes btnBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.05); }
}

/* ==========================================
   Episode Item Entrance Animation
   ========================================== */
.episode-item {
    animation: episodeItemEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.episode-item:nth-child(1) { animation-delay: 0.05s; }
.episode-item:nth-child(2) { animation-delay: 0.10s; }
.episode-item:nth-child(3) { animation-delay: 0.15s; }
.episode-item:nth-child(4) { animation-delay: 0.20s; }
.episode-item:nth-child(5) { animation-delay: 0.25s; }
.episode-item:nth-child(n+6) { animation-delay: 0.30s; }

@keyframes episodeItemEnter {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==========================================
   Save Feedback Toast
   ========================================== */
.save-feedback {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgb(201, 123, 138) 0%, rgb(155, 109, 181) 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 5px 20px rgba(201, 123, 138, 0.4);
    animation: toastEnter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, toastExit 0.3s ease-in 1.7s forwards;
}

@keyframes toastEnter {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastExit {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* ==========================================
   Floating Animation (for decorative elements)
   ========================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==========================================
   Pulse Animation (for pins)
   ========================================== */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.5); opacity: 0.3; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* ==========================================
   Shimmer Loading
   ========================================== */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* ==========================================
   Warp Effect (Earth rotation)
   ========================================== */
.warp-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
    z-index: 500;
    animation: warpFlash 0.5s ease-out forwards;
}

@keyframes warpFlash {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}
