/* ============================================
   가챠 시스템 스타일시트
   원신 스타일 UI/UX
   ============================================ */

/* CSS 변수 정의 */
:root {
    /* 등급별 색상 */
    --color-common: #9ca3af;
    --color-common-glow: rgba(156, 163, 175, 0.6);
    --color-miss: #6b7280;
    --color-miss-glow: rgba(107, 114, 128, 0.45);
    --color-rare: #3b82f6;
    --color-rare-glow: rgba(59, 130, 246, 0.6);
    --color-epic: #a855f7;
    --color-epic-glow: rgba(168, 85, 247, 0.6);
    --color-unique: #eab308;
    --color-unique-glow: rgba(234, 179, 8, 0.6);
    --color-legendary: #ef4444;
    --color-legendary-glow: rgba(239, 68, 68, 0.6);

    /* UI 색상 */
    --bg-dark: #0a0a0f;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-gold: #ffd700;
    --accent-blue: #4fc3f7;

    /* 폰트 */
    --font-display: 'Cinzel', serif;
    --font-body: 'Noto Sans KR', sans-serif;

    /* 타이밍 */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 리셋 & 기본 스타일 */
.gacha-container *, .gacha-container *::before, .gacha-container *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

/* ============================================
   메인 컨테이너
   ============================================ */
.gacha-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   배너 슬라이더
   ============================================ */
.banner-wrapper {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.banner-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.banner-slide.active {
    opacity: 1;
    visibility: visible;
}

.banner-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.05);
    animation: bannerFloat 20s ease-in-out infinite;
}

@keyframes bannerFloat {
    0%, 100% { transform: scale(1.05) translate(0, 0); }
    25% { transform: scale(1.08) translate(-1%, 1%); }
    50% { transform: scale(1.05) translate(1%, -1%); }
    75% { transform: scale(1.08) translate(-0.5%, 0.5%); }
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

.banner-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5vh 8vw;
}

.banner-title-group {
    max-width: 45%;
    z-index: 2;
}

.banner-subtitle {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    color: var(--bg-dark);
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 2px;
    margin-bottom: 1rem;
    animation: subtitleGlow 2s ease-in-out infinite;
}

@keyframes subtitleGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

.banner-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1.1;
    margin-bottom: 1rem;
    text-shadow: 
        0 0 40px rgba(255, 255, 255, 0.3),
        0 4px 20px rgba(0, 0, 0, 0.5);
    background: linear-gradient(180deg, #ffffff 0%, #d4d4d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.banner-desc {
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.highlight-char {
    color: var(--color-legendary);
    font-weight: 600;
    text-shadow: 0 0 20px var(--color-legendary-glow);
}

.highlight-weapon {
    color: var(--color-epic);
    font-weight: 600;
    text-shadow: 0 0 20px var(--color-epic-glow);
}

/* 피쳐드 캐릭터 */
.featured-character {
    position: relative;
    width: 40%;
    max-width: 500px;
    aspect-ratio: 3/4;
    z-index: 2;
}

.char-glow {
    position: absolute;
    inset: -20%;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    animation: charGlow 3s ease-in-out infinite;
}

.char-glow.legendary { background: var(--color-legendary); }
.char-glow.unique { background: var(--color-unique); }
.char-glow.epic { background: var(--color-epic); }

@keyframes charGlow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.char-image {
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

/* 네비게이션 화살표 */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(40px, 5vw, 60px);
    height: clamp(60px, 10vh, 100px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.nav-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.nav-arrow svg {
    width: 24px;
    height: 24px;
}

.nav-prev { left: 1rem; }
.nav-next { right: 1rem; }

/* 배너 인디케이터 */
.banner-indicators {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.indicator.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px var(--accent-gold);
    transform: scale(1.2);
}

.indicator:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   파티클 효과
   ============================================ */
.particles-container {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

/* ============================================
   상단 바
   ============================================ */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    z-index: 10;
}

.currency-display {
    display: flex;
    gap: 1.5rem;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.currency-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.currency-icon.gem {
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.currency-icon.ticket {
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.currency-amount {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.pity-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.pity-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pity-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.pity-max {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   좌측 하단 버튼
   ============================================ */
.bottom-left-buttons {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10;
}

.info-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
}

.info-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
}

.info-btn svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

/* ============================================
   우측 하단 소환 버튼
   ============================================ */
.bottom-right-buttons {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 10;
}

.summon-btn {
    position: relative;
    min-width: 160px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    overflow: visible;
}

.btn-glow {
    position: absolute;
    inset: -5px;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    border-radius: 12px;
    opacity: 0;
    filter: blur(15px);
    transition: var(--transition-smooth);
    z-index: -1;
}

.summon-btn:hover .btn-glow {
    opacity: 0.6;
}

.btn-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.9), rgba(20, 20, 30, 0.95));
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

.summon-btn:hover .btn-content {
    border-color: var(--accent-gold);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.summon-btn:active .btn-content {
    transform: translateY(-1px);
}

.btn-icon {
    position: relative;
    width: 36px;
    height: 36px;
}

.star-icon {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: starPulse 2s ease-in-out infinite;
}

.star-icon.multi {
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
}

@keyframes starPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(10deg); }
}

.btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.btn-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.btn-count {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-cost {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.cost-icon {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    border-radius: 50%;
}

.btn-cost span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* ============================================
   소환 오버레이
   ============================================ */
.summon-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.summon-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 소환 하늘 배경 */
.summon-sky {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.sky-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        #0a0a1a 0%,
        #1a1a3a 30%,
        #2a1a4a 60%,
        #1a0a2a 100%
    );
}

.stars-layer {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 40% 70%, white, transparent),
        radial-gradient(1px 1px at 60% 20%, white, transparent),
        radial-gradient(2px 2px at 80% 50%, white, transparent),
        radial-gradient(1px 1px at 30% 80%, white, transparent),
        radial-gradient(2px 2px at 70% 90%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 90% 30%, white, transparent);
    animation: starsFlicker 4s ease-in-out infinite;
}

@keyframes starsFlicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.aurora-layer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(124, 58, 237, 0.1) 50%,
        transparent 70%
    );
    animation: auroraMove 8s ease-in-out infinite;
}

@keyframes auroraMove {
    0%, 100% { transform: translateX(-20%) rotate(0deg); }
    50% { transform: translateX(20%) rotate(5deg); }
}

.light-rays {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 100%;
    background: conic-gradient(
        from 270deg at 50% 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.03) 45%,
        transparent 50%,
        rgba(255, 255, 255, 0.03) 55%,
        transparent 60%
    );
    opacity: 0;
    animation: raysReveal 2s ease-out forwards;
    animation-delay: 0.5s;
}

@keyframes raysReveal {
    to { opacity: 1; }
}

/* ============================================
   단일 소환 애니메이션
   ============================================ */
.single-summon-animation {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}

.single-summon-animation.active {
    display: flex;
}

/* 유성 */
.meteor-container {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.meteor-container.active {
    animation: meteorFall 1.5s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes meteorFall {
    0% {
        top: -20%;
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }
    20% {
        opacity: 1;
    }
    100% {
        top: 50%;
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

.meteor {
    position: relative;
    width: 60px;
    height: 60px;
}

.meteor-core {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #fff 0%, var(--accent-gold) 50%, transparent 70%);
    border-radius: 50%;
    box-shadow: 
        0 0 30px var(--accent-gold),
        0 0 60px var(--accent-gold),
        0 0 90px rgba(255, 215, 0, 0.5);
    animation: coreGlow 0.5s ease-in-out infinite alternate;
}

@keyframes coreGlow {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

.meteor-trail {
    position: absolute;
    top: -200px;
    left: 50%;
    width: 4px;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--accent-gold));
    transform: translateX(-50%);
    filter: blur(2px);
}

/* 보물상자 */
.chest-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.chest-container.active {
    animation: chestAppear 0.5s ease-out forwards;
}

@keyframes chestAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.chest {
    position: relative;
    width: 150px;
    height: 150px;
}

.chest-glow {
    position: absolute;
    inset: -50%;
    border-radius: 50%;
    background: var(--accent-gold);
    filter: blur(40px);
    opacity: 0.5;
    animation: chestGlowPulse 1s ease-in-out infinite;
}

@keyframes chestGlowPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.chest-body {
    position: relative;
    width: 100%;
    height: 100%;
    animation: chestShake 0.1s ease-in-out;
    animation-iteration-count: 5;
    animation-delay: 0.5s;
}

@keyframes chestShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.chest-base {
    position: absolute;
    bottom: 20%;
    left: 10%;
    width: 80%;
    height: 50%;
    background: linear-gradient(135deg, #8b6914, #c9a227, #8b6914);
    border-radius: 8px;
    box-shadow: 
        inset 0 -10px 20px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.5);
}

.chest-lid {
    position: absolute;
    bottom: 55%;
    left: 5%;
    width: 90%;
    height: 35%;
    background: linear-gradient(135deg, #c9a227, #ffd700, #c9a227);
    border-radius: 8px 8px 0 0;
    transform-origin: bottom center;
    box-shadow: 
        inset 0 5px 15px rgba(255, 255, 255, 0.3),
        0 -3px 10px rgba(0, 0, 0, 0.3);
}

.chest-container.open .chest-lid {
    animation: lidOpen 0.5s ease-out forwards;
}

@keyframes lidOpen {
    to {
        transform: rotateX(-120deg) translateY(-20px);
    }
}

/* 아이템 공개 */
.reveal-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.reveal-container.active {
    opacity: 1;
    visibility: visible;
    animation: revealFadeIn 0.5s ease-out;
}

@keyframes revealFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.reveal-burst {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--current-rarity-glow, white) 0%, transparent 70%);
    opacity: 0;
    animation: burstExpand 0.8s ease-out forwards;
}

@keyframes burstExpand {
    0% {
        opacity: 1;
        transform: scale(0);
    }
    100% {
        opacity: 0;
        transform: scale(3);
    }
}

.reveal-item {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: itemReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes itemReveal {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.item-frame {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(20, 20, 30, 0.9);
    border: 3px solid;
    border-color: var(--current-rarity, white);
}

.item-glow {
    position: absolute;
    inset: -50%;
    background: var(--current-rarity-glow, white);
    filter: blur(40px);
    opacity: 0.5;
    animation: itemGlow 2s ease-in-out infinite;
}

@keyframes itemGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.item-image {
    position: absolute;
    inset: 10px;
    background: linear-gradient(135deg, #333, #555);
    border-radius: 8px;
}

.item-image.miss {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 0 18px rgba(107, 114, 128, 0.6);
}

.item-rarity {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, var(--current-rarity-glow, white), transparent);
}

.item-info {
    margin-top: 1.5rem;
    text-align: center;
}

.item-name {
    display: block;
    font-family: var(--font-display);
    font-size: 1.4rem; /* 1.8rem에서 약간 축소 */
    font-weight: 600;
    color: var(--current-rarity, white);
    text-shadow: 0 0 20px var(--current-rarity-glow, white);
    margin-bottom: 0.5rem;
    
    /* 긴 이름 처리 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.item-type {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* 등급별 스타일 클래스 */
.rarity-common {
    --current-rarity: var(--color-common);
    --current-rarity-glow: var(--color-common-glow);
}

.rarity-miss {
    --current-rarity: var(--color-miss);
    --current-rarity-glow: var(--color-miss-glow);
}

.rarity-rare {
    --current-rarity: var(--color-rare);
    --current-rarity-glow: var(--color-rare-glow);
}

.rarity-epic {
    --current-rarity: var(--color-epic);
    --current-rarity-glow: var(--color-epic-glow);
}

.rarity-unique {
    --current-rarity: var(--color-unique);
    --current-rarity-glow: var(--color-unique-glow);
}

.rarity-legendary {
    --current-rarity: var(--color-legendary);
    --current-rarity-glow: var(--color-legendary-glow);
}

/* ... 기존 CSS 내용들 ... */

/* =========================================
   등급별 모서리 이펙트 (Rarity Corner Glow)
   ========================================= */

/* 아이템 카드 기본 스타일 (이펙트 컨테이너 역할) */
.summon-result-item {
    position: relative;
    overflow: hidden; /* 이펙트가 카드 밖으로 너무 튀어나가지 않게 잘림 */
    /* 기존 테두리가 있다면 덮어씌워질 수 있음. 부드러운 색상 전환을 위해 추가 */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent; /* 기본 테두리 투명 */
    z-index: 1; /* 이펙트가 내용물 위에 오도록 */
}

/* 모서리 이펙트 공통 정의 (가상 요소 사용) */
.summon-result-item::before,
.summon-result-item::after {
    content: '';
    position: absolute;
    width: 60%; /* 너비 */
    height: 60%; /* 높이 */
    pointer-events: none; /* 마우스 이벤트 통과 */
    z-index: -1; /* 내용물(텍스트/이미지) 보다는 뒤에 위치 */
    opacity: 0.7; /* 너무 강하지 않게 투명도 조절 */
    filter: blur(15px); /* 부드럽게 번지는 효과 */
    transition: opacity 0.5s ease;
}

/* 왼쪽 상단 모서리 이펙트 */
.summon-result-item::before {
    top: -10%;
    left: -10%;
    /* 정의된 --glow-color 변수를 사용하여 대각선 그라데이션 적용 */
    background: radial-gradient(circle at top left, var(--glow-color, transparent) 0%, transparent 60%);
}

/* 오른쪽 하단 모서리 이펙트 */
.summon-result-item::after {
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle at bottom right, var(--glow-color, transparent) 0%, transparent 60%);
}

/* 아이템 등장 시 약간의 반짝임 애니메이션 */
@keyframes rarityPulse {
    0% { opacity: 0.5; filter: blur(15px); }
    50% { opacity: 0.9; filter: blur(20px); }
    100% { opacity: 0.7; filter: blur(15px); }
}
.summon-result-item.show .summon-result-item::before,
.summon-result-item.show .summon-result-item::after {
     animation: rarityPulse 3s infinite ease-in-out;
}


/* --- [ 등급별 색상 적용 ] --- */
/* JS에서 해당 클래스(common, rare 등)를 붙여주면 이 변수들이 적용됨 */

/* 커먼 (Common) - 흰색 */
.summon-result-item.common {
    --glow-color: var(--color-common-glow);
    border-color: rgba(255, 255, 255, 0.3); /* 약한 흰색 테두리 */
}

.summon-result-item.miss {
    --glow-color: var(--color-miss-glow);
    border-color: rgba(107, 114, 128, 0.65);
    box-shadow: inset 0 0 14px rgba(107, 114, 128, 0.32), 0 0 12px rgba(107, 114, 128, 0.22);
}

/* 레어 (Rare) - 파란색 */
.summon-result-item.rare {
    --glow-color: var(--color-rare-glow);
    border-color: rgba(59, 130, 246, 0.4);
}

/* 에픽 (Epic) - 보라색 */
.summon-result-item.epic {
    --glow-color: var(--color-epic-glow);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: inset 0 0 10px var(--color-epic-glow); /* 내부 광원 추가 */
}

/* 유니크 (Unique) - 노란색 */
.summon-result-item.unique {
    --glow-color: var(--color-unique-glow);
    border-color: var(--color-unique);
    box-shadow: inset 0 0 15px rgba(234, 179, 8, 0.4), 0 0 10px var(--color-unique-glow);
}

/* 레전더리 (Legendary) - 빨간색 (가장 강렬하게) */
.summon-result-item.legendary {
    --glow-color: var(--color-legendary-glow);
    border-color: var(--color-legendary);
    /* 안팎으로 강한 붉은색 빛 번짐 */
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.5), 0 0 20px var(--color-legendary-glow);
    /* 레전더리는 이펙트를 조금 더 진하게 */
    &::before, &::after { opacity: 0.9; filter: blur(18px); }
}

/* ============================================
   10연차 소환 애니메이션
   ============================================ */
.multi-summon-animation {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}

.multi-summon-animation.active {
    display: flex;
}

.multi-meteor-container {
    position: absolute;
    inset: 0;
}

.multi-meteor {
    position: absolute;
    width: 30px;
    height: 30px;
    opacity: 0;
}

.multi-meteor .meteor-core {
    width: 100%;
    height: 100%;
}

.multi-meteor .meteor-trail {
    height: 100px;
    top: -100px;
}

.multi-meteor[data-index="0"] { left: 10%; }
.multi-meteor[data-index="1"] { left: 20%; }
.multi-meteor[data-index="2"] { left: 30%; }
.multi-meteor[data-index="3"] { left: 40%; }
.multi-meteor[data-index="4"] { left: 50%; }
.multi-meteor[data-index="5"] { left: 60%; }
.multi-meteor[data-index="6"] { left: 70%; }
.multi-meteor[data-index="7"] { left: 80%; }
.multi-meteor[data-index="8"] { left: 85%; }
.multi-meteor[data-index="9"] { left: 15%; }

.multi-meteor.active {
    animation: multiMeteorFall 1s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes multiMeteorFall {
    0% {
        top: -10%;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        top: 40%;
        opacity: 1;
    }
}

/* 10연차 보물상자 */
.multi-chest-container {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 80%;
    max-width: 600px;
}

.multi-chest {
    position: relative;
    width: 60px;
    height: 60px;
    opacity: 0;
}

.multi-chest.active {
    animation: multiChestAppear 0.3s ease-out forwards;
}

.multi-chest .chest-glow {
    inset: -30%;
    filter: blur(20px);
}

.multi-chest .chest-mini {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #c9a227, #ffd700);
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

.multi-chest.shake .chest-mini {
    animation: chestShake 0.08s ease-in-out 8;
}

.multi-chest.burst {
    animation: multiChestBurst 0.5s ease-out forwards;
}

@keyframes multiChestAppear {
    from {
        opacity: 0;
        transform: scale(0) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

/* 10연차 결과 그리드 */
.multi-reveal-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.multi-reveal-container.active {
    opacity: 1;
    visibility: visible;
}

.reveal-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    padding: 2rem;
    max-width: 900px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: scale(0);
}

.grid-item.reveal {
    animation: gridItemReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes gridItemReveal {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.grid-item .item-frame {
    width: 120px;
    height: 120px;
    border-width: 2px;
}

.grid-item .item-glow {
    filter: blur(25px);
}

.grid-item .item-rarity-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--current-rarity, white);
}

.grid-item .item-name {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--current-rarity, white);
}

/* ============================================
   스킵 & 확인 버튼
   ============================================ */
.skip-btn, .confirm-btn {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.skip-btn {
    bottom: 2rem;
    right: 2rem;
    opacity: 0;
}

.skip-btn.visible {
    opacity: 1;
}

.skip-btn svg {
    width: 18px;
    height: 18px;
}

.confirm-btn {
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 3rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    border: none;
    color: var(--bg-dark);
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
}

.confirm-btn.visible {
    opacity: 1;
    visibility: visible;
    animation: confirmAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.skip-btn:hover, .confirm-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.skip-btn:hover {
    transform: scale(1.05);
}

/* ============================================
   모달
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 40, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--accent-gold);
}

/* 확률 리스트 */
.probability-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prob-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid;
}

.prob-item.legendary { border-color: var(--color-legendary); }
.prob-item.unique { border-color: var(--color-unique); }
.prob-item.epic { border-color: var(--color-epic); }
.prob-item.rare { border-color: var(--color-rare); }
.prob-item.common { border-color: var(--color-common); }
.prob-item.miss { border-color: var(--color-miss); }

.prob-rarity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rarity-stars {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.prob-item.legendary .rarity-stars { color: var(--color-legendary); }
.prob-item.unique .rarity-stars { color: var(--color-unique); }
.prob-item.epic .rarity-stars { color: var(--color-epic); }
.prob-item.rare .rarity-stars { color: var(--color-rare); }
.prob-item.common .rarity-stars { color: var(--color-common); }
.prob-item.miss .rarity-stars { color: var(--color-miss); }

.rarity-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.prob-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pity-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pity-info h3 {
    font-size: 1rem;
    color: var(--accent-gold);
    margin-bottom: 0.75rem;
}

.pity-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* 히스토리 리스트 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid;
}

.history-item.legendary { border-color: var(--color-legendary); }
.history-item.unique { border-color: var(--color-unique); }
.history-item.epic { border-color: var(--color-epic); }
.history-item.rare { border-color: var(--color-rare); }
.history-item.common { border-color: var(--color-common); }
.history-item.miss { border-color: var(--color-miss); }

.history-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.history-icon.miss {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.95), rgba(75, 85, 99, 0.9));
}

.history-info {
    flex: 1;
}

.history-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.history-item.legendary .history-name { color: var(--color-legendary); }
.history-item.unique .history-name { color: var(--color-unique); }
.history-item.epic .history-name { color: var(--color-epic); }
.history-item.rare .history-name { color: var(--color-rare); }
.history-item.common .history-name { color: var(--color-common); }
.history-item.miss .history-name { color: var(--color-miss); }

.history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================
   반응형 디자인
   ============================================ */

/* 태블릿 */
@media (max-width: 1024px) {
    .banner-content {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding: 3vh 5vw;
    }

    .banner-title-group {
        max-width: 100%;
        margin-bottom: 2rem;
    }

    .featured-character {
        width: 50%;
        max-width: 300px;
    }

    .bottom-right-buttons {
        flex-direction: column;
    }

    .reveal-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.75rem;
    }

    .grid-item .item-frame {
        width: 100px;
        height: 100px;
    }
}

/* 모바일 가로 */
@media (max-width: 768px) {
    .top-bar {
        padding: 1rem;
    }

    .currency-display {
        gap: 0.75rem;
    }

    .currency-item {
        padding: 0.4rem 0.75rem;
    }

    .currency-amount {
        font-size: 0.85rem;
    }

    .pity-counter {
        padding: 0.4rem 1rem;
    }

    .nav-arrow {
        width: 35px;
        height: 50px;
    }

    .nav-arrow svg {
        width: 18px;
        height: 18px;
    }

    .bottom-left-buttons {
        left: 1rem;
        bottom: 1.5rem;
    }

    .info-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .bottom-right-buttons {
        right: 1rem;
        bottom: 1.5rem;
        gap: 0.75rem;
    }

    .summon-btn {
        min-width: 130px;
    }

    .btn-content {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .btn-icon {
        width: 28px;
        height: 28px;
    }

    .btn-count {
        font-size: 1.1rem;
    }

    .btn-cost span {
        font-size: 0.8rem;
    }

    .banner-indicators {
        bottom: 20%;
    }

    .reveal-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
        padding: 1rem;
    }

    .grid-item .item-frame {
        width: 70px;
        height: 70px;
    }

    .grid-item .item-name {
        font-size: 0.7rem;
    }

    .item-frame {
        width: 150px;
        height: 150px;
    }

    .item-name {
        font-size: 1.4rem;
    }
}

/* 모바일 세로 */
@media (max-width: 480px) {
    .banner-title {
        font-size: 1.8rem;
    }

    .banner-desc {
        font-size: 0.85rem;
    }

    .banner-subtitle {
        padding: 0.4rem 1rem;
        font-size: 0.65rem;
    }

    .featured-character {
        width: 60%;
    }

    .currency-display {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pity-counter {
        display: none;
    }

    .info-btn span {
        display: none;
    }

    .info-btn {
        padding: 0.75rem;
    }

    .summon-btn {
        min-width: auto;
    }

    .btn-content {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.25rem;
    }

    .btn-text {
        align-items: center;
    }

    .btn-cost {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

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

    .grid-item .item-frame {
        width: 100px;
        height: 100px;
    }

    .skip-btn, .confirm-btn {
        bottom: 1rem;
    }

    .skip-btn {
        right: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .confirm-btn {
        padding: 0.85rem 2rem;
        font-size: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
    }
}

/* 가로 모드 강제 시 */
@media (max-height: 500px) and (orientation: landscape) {
    .banner-content {
        flex-direction: row;
        padding: 2vh 5vw;
    }

    .banner-title-group {
        max-width: 50%;
    }

    .banner-title {
        font-size: 2rem;
    }

    .featured-character {
        width: 30%;
    }

    .top-bar {
        padding: 0.5rem 1rem;
    }

    .bottom-left-buttons,
    .bottom-right-buttons {
        bottom: 0.75rem;
    }

    .reveal-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .grid-item .item-frame {
        width: 60px;
        height: 60px;
    }
}

/* 터치 장치 최적화 */
@media (hover: none) and (pointer: coarse) {
    .nav-arrow,
    .info-btn,
    .summon-btn,
    .skip-btn,
    .confirm-btn {
        -webkit-tap-highlight-color: transparent;
    }

    .nav-arrow:active {
        background: rgba(255, 255, 255, 0.2);
    }

    .summon-btn:active .btn-content {
        transform: scale(0.98);
    }
}

/* 다크 모드 지원 (기본이 다크) */
@media (prefers-color-scheme: light) {
    /* 이 UI는 다크 모드 전용이므로 변경 없음 */
}

/* 접근성: 동작 감소 선호 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 가챠 상단 유저 영역 */
.gacha-top-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.gacha-profile {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.85rem 0.4rem 0.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.gacha-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c8a86b, #e8d5a3);
    color: #1a1206;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gacha-nickname {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gacha-login-wrap button {
    background: rgba(200, 168, 107, 0.15) !important;
    border: 1px solid rgba(200, 168, 107, 0.5) !important;
    color: #e8d5a3 !important;
    border-radius: 999px !important;
    padding: 0.4rem 1rem !important;
    font-size: 0.8rem !important;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}

.gacha-login-wrap button:hover {
    background: rgba(200, 168, 107, 0.28) !important;
}

/* 배너 1개일 때 네비게이션/인디케이터 숨김 */
.banner-slider:has(.banner-slide:only-child) ~ .nav-arrow,
.banner-slider:has(.banner-slide:only-child) ~ .banner-indicators {
    display: none !important;
}

/* 가챠 뒤로가기 버튼 */
.gacha-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
    flex-shrink: 0;
}

.gacha-back-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}
