/* 
   RANK DUEL SPECIFIC STYLES
   This file is COMPLETELY SEPARATE from layout_main.css to protect Bot Match stability.
*/

#rank-matching-view {
    position: fixed;
    inset: 0;
    z-index: 9500; /* Higher than lobby */
    background: #050508 !important;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
}

#rank-matching-view .vs-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    transition: filter 1.2s cubic-bezier(0.165, 0.84, 0.44, 1), 
                transform 1.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: filter, transform;
}

/* --- Mystical Searching State --- */
#rank-matching-view.mystical .vs-bg {
    background: radial-gradient(circle at center, #2c1a12 0%, #050508 100%);
    filter: blur(0px);
    transform: scale(1);
}

.rank-searching-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#rank-matching-view.mystical .rank-searching-overlay {
    display: flex;
}

.rank-searching-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    animation: rankMysticalPulse 2s ease-in-out infinite;
    letter-spacing: 2px;
}

@keyframes rankMysticalPulse {
    0% { transform: scale(0.95); opacity: 0.6; filter: blur(1px); }
    50% { transform: scale(1.05); opacity: 1; filter: blur(0); }
    100% { transform: scale(0.95); opacity: 0.6; filter: blur(1px); }
}

/* --- Base Layout for Rank Matching Characters --- */
#rank-matching-view .avatar-container-divine {
    width: 100px !important;
    height: 100px !important;
    border-width: 4px !important;
}
#rank-matching-view .avatar-container-divine::after {
    inset: -4px !important;
    border-width: 4px !important;
}
#rank-matching-view .player-box {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    opacity: 0;
}
#rank-matching-view .user-box {
    bottom: calc(15% + 60px);
    left: 5%;
    transform: translateY(50%) translateX(-150%);
}
#rank-matching-view .bot-box {
    top: calc(15% + 60px);
    right: 5%;
    transform: translateY(-50%) translateX(150%);
    flex-direction: row-reverse;
}
#rank-matching-view .info-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
#rank-matching-view .user-box .info-group {
    align-items: flex-start;
}
#rank-matching-view .bot-box .info-group {
    align-items: flex-end;
}

/* --- Reveal / Exit Animations --- */




@keyframes rankVsEnterLeft {
    0% { transform: translate(-150%, 50%); opacity: 0; }
    100% { transform: translate(0, 50%); opacity: 1; }
}
@keyframes rankVsEnterRight {
    0% { transform: translate(150%, -50%); opacity: 0; }
    100% { transform: translate(0, -50%); opacity: 1; }
}
@keyframes rankVsEnterCenter {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}

/* --- Exit: Shrink & Fade --- */




@keyframes rankVsExitLeft {
    0% { transform: translate(0, 50%); opacity: 1; }
    100% { transform: translate(-150%, 50%); opacity: 0; }
}
@keyframes rankVsExitRight {
    0% { transform: translate(0, -50%); opacity: 1; }
    100% { transform: translate(150%, -50%); opacity: 0; }
}
@keyframes rankVsExitShrink {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}

#rank-matching-view .vs-bg.blurred {
    filter: blur(12px) brightness(0.5);
    transform: scale(1.2); /* 확실한 확대 효과 */
}

/* 진입 시 축소 효과를 위한 별도 클래스 (선택 사항) */
#rank-matching-view .vs-bg.zoom-out {
    filter: blur(0px) brightness(1);
    transform: scale(1);
}

#rank-matching-view .vs-center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 4rem;
    font-weight: 900;
    font-style: italic;
    font-family: 'Black Han Sans', sans-serif;
    color: #dca450;
    -webkit-text-stroke: 1.5px rgba(120, 70, 0, 0.6);
    text-shadow: 0 0 30px rgba(220, 164, 80, 0.8), 4px 4px 0px rgba(60, 30, 10, 0.8);
    z-index: 5;
    opacity: 0;
}


/* ======== DUPLICATED FROM LAYOUT_MAIN.CSS FOR RANK ======== */
#rank-matching-view {
    z-index: 2000;
    background: #2c1a12 !important;
    overflow: hidden !important;
    align-items: center;
    justify-content: center;
}

/* 1. 스테이지 랜덤 배경 이미지 (duel.js에서 설정됨) */
#rank-matching-view .vs-bg {
    position: absolute;
    inset: 0; 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    /* No blur, no zoom, original state maintained */
}

/* =========================================
   EFFECT 3: 차원 포탈 낙하 (Drop Warp)
   ========================================= */
#rank-matching-view .vs-bg.eff3-matching {
    transform: scale(1.5) !important; /* 극단적 확대 */
    filter: blur(8px) brightness(0.5) !important;
    transition: none !important;
}

#rank-matching-view .vs-bg.eff3-reveal {
    transform: scale(1) !important;
    filter: blur(0px) brightness(1) !important;
    /* 초반속도 엄청 빠름 -> 나중에 천천히 (Cubic Bezier) */
    transition: transform 1.5s cubic-bezier(0.075, 0.82, 0.165, 1), 
                filter 1s ease-out !important;
}

/* 원본 그대로 보이기 위해 오버레이 삭제/투명화 */
#rank-matching-view .mirage-overlay {
    display: none;
}

/* 중앙 VS 로고 */
#rank-matching-view .vs-center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 4rem;
    font-weight: 900;
    font-style: italic;
    font-family: var(--title-font, 'Black Han Sans');
    /* [Fix] background-clip:text 포기 - 폰트 픽셀 투명 구간에서 S 우측 빔 현상 구조적 문제
       원본 그라디언트 끝색 #dca450을 직접 fill로 사용 → 완전히 채워짐 */
    color: #dca450;
    -webkit-text-fill-color: #dca450;
    -webkit-text-stroke: 1.5px rgba(120, 70, 0, 0.6);
    text-shadow: 0 0 30px rgba(220, 164, 80, 0.8), 4px 4px 0px rgba(60, 30, 10, 0.8);
    z-index: 5;
    opacity: 0;
    animation: popInVs 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.3) 0.6s forwards;
}


/* 플레이어 컨테이너 오버라이드 (100% 확대) */
#rank-matching-view .avatar-container-divine {
    width: 100px !important;
    height: 100px !important;
    border-width: 4px !important;
}

#rank-matching-view .avatar-container-divine::after {
    inset: -4px !important;
    border-width: 4px !important;
}

/* 플레이어 컨테이너 */
#rank-matching-view .player-box {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    opacity: 0;
}

/* 유저: 좌측 하단 → 중앙 방향 */
#rank-matching-view .user-box {
    bottom: calc(15% + 60px);
    left: 5%;
    transform: translateY(50%);
    animation: slideInUser 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards;
}

/* 상대방: 우측 상단 → 중앙 방향 */
#rank-matching-view .bot-box {
    top: calc(15% + 60px);
    right: 5%;
    transform: translateY(-50%);
    flex-direction: row-reverse;
    animation: slideInBot 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards;
}

/* 닉네임 그룹 박스 */
#rank-matching-view .info-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#rank-matching-view .user-box .info-group {
    align-items: flex-start;
}

#rank-matching-view .bot-box .info-group {
    align-items: flex-end;
}

/* 닉네임 & 티어 텍스트 스타일 */
#rank-matching-view .nickname {
    font-size: 32px;
    /* 폰트도 함께 확대 */
    font-weight: 900;
    letter-spacing: 1.5px;
    white-space: nowrap;
    line-height: 1.1;
}

#rank-matching-view .tier-label {
    font-size: 18px;
    /* 폰트도 함께 확대 */
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

#rank-matching-view .user-box .nickname {
    color: #fff;
    text-shadow: 0 0 15px var(--neon-blue), 0 0 30px var(--neon-blue);
}

#rank-matching-view .user-box .tier-label {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.8);
}

#rank-matching-view .bot-box .nickname {
    color: #fff;
    text-shadow: 0 0 15px var(--neon-red), 0 0 30px var(--neon-red);
    text-align: right;
}

#rank-matching-view {
    z-index: 2000;
    background: #2c1a12 !important;
    overflow: hidden !important;
    align-items: center;
    justify-content: center;
}

/* 1. 스테이지 랜덤 배경 이미지 (duel.js에서 설정됨) */
#rank-matching-view .vs-bg {
    position: absolute;
    inset: 0; 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    /* No blur, no zoom, original state maintained */
}

/* =========================================
   EFFECT 3: 차원 포탈 낙하 (Drop Warp)
   ========================================= */
#rank-matching-view .vs-bg.eff3-matching {
    transform: scale(1.5) !important; /* 극단적 확대 */
    filter: blur(8px) brightness(0.5) !important;
    transition: none !important;
}

#rank-matching-view .vs-bg.eff3-reveal {
    transform: scale(1) !important;
    filter: blur(0px) brightness(1) !important;
    /* 초반속도 엄청 빠름 -> 나중에 천천히 (Cubic Bezier) */
    transition: transform 1.5s cubic-bezier(0.075, 0.82, 0.165, 1), 
                filter 1s ease-out !important;
}

/* 원본 그대로 보이기 위해 오버레이 삭제/투명화 */
#rank-matching-view .mirage-overlay {
    display: none;
}

/* 중앙 VS 로고 */
#rank-matching-view .vs-center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 4rem;
    font-weight: 900;
    font-style: italic;
    font-family: var(--title-font, 'Black Han Sans');
    /* [Fix] background-clip:text 포기 - 폰트 픽셀 투명 구간에서 S 우측 빔 현상 구조적 문제
       원본 그라디언트 끝색 #dca450을 직접 fill로 사용 → 완전히 채워짐 */
    color: #dca450;
    -webkit-text-fill-color: #dca450;
    -webkit-text-stroke: 1.5px rgba(120, 70, 0, 0.6);
    text-shadow: 0 0 30px rgba(220, 164, 80, 0.8), 4px 4px 0px rgba(60, 30, 10, 0.8);
    z-index: 5;
    opacity: 0;
    animation: popInVs 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.3) 0.6s forwards;
}


/* 플레이어 컨테이너 오버라이드 (100% 확대) */
#rank-matching-view .avatar-container-divine {
    width: 100px !important;
    height: 100px !important;
    border-width: 4px !important;
}

#rank-matching-view .avatar-container-divine::after {
    inset: -4px !important;
    border-width: 4px !important;
}

/* 플레이어 컨테이너 */
#rank-matching-view .player-box {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    opacity: 0;
}

/* 유저: 좌측 하단 → 중앙 방향 */
#rank-matching-view .user-box {
    bottom: calc(15% + 60px);
    left: 5%;
    transform: translateY(50%);
    animation: slideInUser 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards;
}

/* 상대방: 우측 상단 → 중앙 방향 */
#rank-matching-view .bot-box {
    top: calc(15% + 60px);
    right: 5%;
    transform: translateY(-50%);
    flex-direction: row-reverse;
    animation: slideInBot 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards;
}

/* 닉네임 그룹 박스 */
#rank-matching-view .info-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#rank-matching-view .user-box .info-group {
    align-items: flex-start;
}

#rank-matching-view .bot-box .info-group {
    align-items: flex-end;
}

/* 닉네임 & 티어 텍스트 스타일 */
#rank-matching-view .nickname {
    font-size: 32px;
    /* 폰트도 함께 확대 */
    font-weight: 900;
    letter-spacing: 1.5px;
    white-space: nowrap;
    line-height: 1.1;
}

#rank-matching-view .tier-label {
    font-size: 18px;
    /* 폰트도 함께 확대 */
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

#rank-matching-view .user-box .nickname {
    color: #fff;
    text-shadow: 0 0 15px var(--neon-blue), 0 0 30px var(--neon-blue);
}

#rank-matching-view .user-box .tier-label {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.8);
}

#rank-matching-view .bot-box .nickname {
    color: #fff;
    text-shadow: 0 0 15px var(--neon-red), 0 0 30px var(--neon-red);
    text-align: right;
}

#rank-matching-view .bot-box .tier-label {
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.8);
    text-align: right;
}

/* 화면을 가르는 스파크 연출 */
#rank-matching-view .slash-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #dca450 50%, transparent 100%);
    /* 금빛 슬래시 */
    transform: translate(-50%, -50%) rotate(-20deg) scaleX(0);
    box-shadow: 0 0 20px #dca450, 0 0 40px rgba(255, 215, 0, 0.8);
    animation: slash 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
    z-index: 4;
}

/* ================================================================
   EXIT ANIMATIONS — anim-out 트리거 (봇모드의 layout_main.css와 동일)
   duel-matching-view 대신 rank-matching-view에 scoping
   ================================================================ */
#rank-matching-view .user-box.anim-out {
    animation: rankVsExitLeft 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}
#rank-matching-view .bot-box.anim-out {
    animation: rankVsExitRight 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}
#rank-matching-view .vs-center-logo.anim-out {
    animation: rankVsExitShrink 0.5s ease-in forwards !important;
}
#rank-matching-view .slash-line.anim-out {
    animation: none !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ================================================================
   VS PULSE — entry animation 완료 후 박동 효과
   layout_main.css의 vsPulse @keyframes를 재사용 (전역 keyframes)
   ================================================================ */
#rank-matching-view .vs-center-logo.vs-pulse {
    animation: vsPulse 1.5s ease-in-out infinite !important;
}

/* --- 최종 승리/패배 연출용 동적 클래스 --- */
#duel-options .option-btn.zoom-gold {
    background: rgba(255, 215, 0, 0.15) !important;
    border-color: #ffd700 !important;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.45), inset 0 0 10px rgba(255, 215, 0, 0.45) !important;
    transform: scale(1.06) translateY(-4px) !important;
    z-index: 10 !important;
}

#duel-options .option-btn.zoom-green {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.45), inset 0 0 10px rgba(16, 185, 129, 0.45) !important;
    transform: scale(1.06) translateY(-4px) !important;
    z-index: 10 !important;
}

#duel-options .option-btn.card-fade-out {
    opacity: 0 !important;
    transform: translateY(40px) scale(0.9) !important;
    pointer-events: none !important;
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

/* ================================================================
   TIER SHIMMER EFFECT — 반사광 효과 전역 클래스
   ================================================================ */
.tier-shimmer {
    position: relative;
    display: inline-block;
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-size: 300% 100%;
    animation: tier-shine-sweep 2.5s ease-in-out infinite;
}
.tier-shimmer-IRON {
    background-image: linear-gradient(
        120deg, #71797e 0%, #71797e 40%, #b0b8be 50%, #71797e 60%, #71797e 100%
    );
}
.tier-shimmer-BRONZE {
    background-image: linear-gradient(
        120deg, #d98c5f 0%, #d98c5f 40%, #ffe0b2 50%, #d98c5f 60%, #d98c5f 100%
    );
}
.tier-shimmer-SILVER {
    background-image: linear-gradient(
        120deg, #c8c8d0 0%, #c8c8d0 30%, #ffffff 48%, #eeeef4 52%, #c8c8d0 70%, #c8c8d0 100%
    );
}
.tier-shimmer-GOLD {
    background-image: linear-gradient(
        120deg, #d4af37 0%, #d4af37 35%, #fff8dc 50%, #d4af37 65%, #d4af37 100%
    );
}
.tier-shimmer-PLATINUM {
    background-image: linear-gradient(
        120deg, #7cb8d4 0%, #7cb8d4 35%, #e0f7ff 50%, #7cb8d4 65%, #7cb8d4 100%
    );
}
.tier-shimmer-DIAMOND {
    background-image: linear-gradient(
        120deg, #00b8d4 0%, #00b8d4 30%, #ffffff 48%, #b3e5fc 52%, #00b8d4 70%, #00b8d4 100%
    );
}
.tier-shimmer-GOD {
    background-image: linear-gradient(
        120deg, #a855f7 0%, #a855f7 30%, #ffd700 45%, #ffffff 50%, #ffd700 55%, #a855f7 70%, #a855f7 100%
    );
}
@keyframes tier-shine-sweep {
    0%   { background-position: 300% center; }
    100% { background-position: -300% center; }
}

