/* ==========================================================================
   THIÊN LONG TỤ BẢO - HIỆU ỨNG KIẾM HIỆP TU TIÊN (WUXIA & XIANXIA EFFECTS)
   Tối ưu 60FPS GPU - Không cản trở thao tác chuột (pointer-events: none)
   ========================================================================== */

/* 1. ANIMATIONS CỐT LÕI (KEYFRAMES) */
@keyframes khFloatSlow {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

@keyframes khLogoAura {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(242, 201, 76, 0.45)) drop-shadow(0 0 18px rgba(212, 175, 55, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 14px rgba(254, 240, 138, 0.85)) drop-shadow(0 0 28px rgba(242, 201, 76, 0.5));
    }
}

@keyframes khPanelReveal {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(0.985);
        filter: brightness(1.3);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }
}

@keyframes khBorderBreath {
    0%, 100% {
        border-color: rgba(212, 175, 55, 0.38);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.85), 0 0 15px rgba(212, 175, 55, 0.1), inset 0 0 20px rgba(212, 175, 55, 0.05);
    }
    50% {
        border-color: rgba(242, 201, 76, 0.72);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 28px rgba(242, 201, 76, 0.25), inset 0 0 30px rgba(242, 201, 76, 0.12);
    }
}

@keyframes khSwordSweep {
    0% { left: -120%; opacity: 0; }
    15% { opacity: 1; }
    45% { left: 140%; opacity: 0; }
    100% { left: 140%; opacity: 0; }
}

@keyframes khBaguaBurst {
    0% {
        transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
        opacity: 0.95;
    }
    60% {
        opacity: 0.65;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.65) rotate(120deg);
        opacity: 0;
    }
}

@keyframes khMistDrift {
    0% { transform: translateX(-5%) scaleY(1); opacity: 0.22; }
    50% { transform: translateX(5%) scaleY(1.08); opacity: 0.36; }
    100% { transform: translateX(-5%) scaleY(1); opacity: 0.22; }
}

@keyframes khTextShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 2. ÁP DỤNG HIỆU ỨNG LINH KHÍ CHO LOGO & HEADER */
.cy-top-logo {
    animation: khLogoAura 3.5s ease-in-out infinite;
}

.nav-menu-changyou::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(242, 201, 76, 0.65) 50%, transparent 100%);
    box-shadow: 0 0 12px rgba(242, 201, 76, 0.6);
    pointer-events: none;
}

/* 3. KHUNG FORM & PANEL PHÁP BẢO (GLASS PANELS) */
.glass-form-cy,
.glass-panel-cy,
.glass-panel {
    position: relative;
    animation: khPanelReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) both,
               khBorderBreath 5s ease-in-out infinite 0.7s;
}

/* Vệt kiếm quang chạy chéo qua các nút hành động */
.cy-btn-side::before,
.download-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 55%;
    height: 100%;
    background: linear-gradient(
        115deg,
        transparent 0%,
        rgba(255, 248, 210, 0.08) 30%,
        rgba(255, 250, 220, 0.55) 50%,
        rgba(255, 248, 210, 0.08) 70%,
        transparent 100%
    );
    transform: skewX(-25deg);
    animation: khSwordSweep 4.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

.cy-btn-side:hover::before {
    animation-duration: 1.4s;
}

/* Nút Tải Game Trung Tâm: Hào quang Pháp Bảo */
.btn-cy-download-main {
    animation: khFloatSlow 4s ease-in-out infinite;
}

.btn-cy-download-main:hover {
    animation-play-state: paused;
}

/* 4. HIỆU ỨNG SƯƠNG MÙ TIÊN CẢNH ĐÁY TRANG */
.kh-mist-overlay {
    position: fixed;
    bottom: -30px;
    left: -10%;
    width: 120%;
    height: 180px;
    background: radial-gradient(ellipse at 50% 100%, rgba(212, 175, 55, 0.09) 0%, rgba(15, 20, 35, 0.35) 45%, transparent 75%);
    filter: blur(18px);
    pointer-events: none;
    z-index: 1;
    animation: khMistDrift 12s ease-in-out infinite;
}

/* 5. CANVAS LINH KHÍ TOÀN TRANG (CHO CÁC TRANG CHƯA CÓ CANVAS) */
#kh-global-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* 6. PHÁP TRẬN BÁT QUÁI KHI CLICK CHUỘT */
.kh-click-bagua {
    position: fixed;
    width: 68px;
    height: 68px;
    pointer-events: none;
    z-index: 9999;
    border-radius: 50%;
    border: 1.5px solid rgba(242, 201, 76, 0.85);
    box-shadow: 0 0 15px rgba(242, 201, 76, 0.6), inset 0 0 10px rgba(242, 201, 76, 0.4);
    animation: khBaguaBurst 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kh-click-bagua::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px dashed rgba(254, 240, 138, 0.75);
    border-radius: 50%;
}

.kh-click-bagua::after {
    content: '❖';
    color: rgba(254, 240, 138, 0.9);
    font-size: 16px;
    text-shadow: 0 0 8px rgba(242, 201, 76, 0.9);
}

/* 7. HOA VĂN 4 GÓC CỔ PHONG CHO KHUNG FORM */
.kh-corner-ornament {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: rgba(242, 201, 76, 0.7);
    border-style: solid;
    pointer-events: none;
    z-index: 20;
    transition: all 0.35s ease;
}

.kh-corner-tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.kh-corner-tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; border-top-right-radius: 6px; }
.kh-corner-bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; border-bottom-left-radius: 6px; }
.kh-corner-br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

.glass-form-cy:hover .kh-corner-ornament,
.glass-panel-cy:hover .kh-corner-ornament,
.glass-panel:hover .kh-corner-ornament {
    width: 22px;
    height: 22px;
    border-color: #fef08a;
    filter: drop-shadow(0 0 6px rgba(242, 201, 76, 0.8));
}

/* 8. HIỆU ỨNG HOVER NÚT KIẾM HIỆP */
.home_btn_main_cy {
    animation: khPanelReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.cy-btn-trailer {
    animation: khFloatSlow 3.2s ease-in-out infinite;
}
