/* 가챠 시스템 스타일 */

/* 가챠 화면 컨테이너 */
.gacha-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gacha-container h2 {
    color: #fff;
    margin-bottom: 8px;
}

.gacha-container .page-desc {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 24px;
}

/* 통화 표시 (골드 & 티켓) */
.gacha-gold-display {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 24px;
    margin-bottom: 32px;
}

.gacha-currency-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: bold;
}

.gacha-currency-item:first-child {
    color: var(--gold-primary);
}

.gacha-currency-item:last-child {
    color: #4dc9ff;
}

.gacha-currency-item .gold-icon,
.gacha-currency-item .ticket-icon {
    font-size: 1.4rem;
}

/* 몬스터볼 가챠 머신 */
.gacha-machine {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 32px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gacha-machine:hover {
    transform: scale(1.05);
}

.gacha-machine .pokeball {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 -5px 20px rgba(0, 0, 0, 0.2);
}

.gacha-machine .pokeball-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48%;
    background: linear-gradient(135deg, #ff5050, #cc0000);
    border-bottom: 6px solid #1a1a2e;
}

.gacha-machine .pokeball-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48%;
    background: linear-gradient(135deg, #fff, #ddd);
}

.gacha-machine .pokeball-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #fff, #ddd);
    border: 6px solid #1a1a2e;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gacha-machine .pokeball-center::after {
    content: '';
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4a90d9, #2563eb);
    border-radius: 50%;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.5);
}

/* 스핀 애니메이션 */
.gacha-machine.spinning .pokeball {
    animation: pokeball-spin 1s ease-in-out infinite;
}

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

    25% {
        transform: rotate(-15deg);
    }

    50% {
        transform: rotate(15deg);
    }

    75% {
        transform: rotate(-10deg);
    }

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

/* 빛 효과 */
.gacha-machine.spinning::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    animation: glow-pulse 0.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glow-pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* 뽑기 버튼 */
.gacha-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.gacha-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
}

.gacha-btn-single {
    background: linear-gradient(135deg, #4a90d9, #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.gacha-btn-single:hover {
    background: linear-gradient(135deg, #5a9fe9, #3573fb);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.gacha-btn-ten {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    position: relative;
}

.gacha-btn-ten:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.gacha-btn-ten .discount-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.gacha-btn .price {
    font-size: 0.85rem;
    opacity: 0.9;
}

.gacha-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 확률 정보 */
.gacha-rates {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.gacha-rate {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.gacha-rate.common {
    background: rgba(128, 128, 128, 0.3);
    color: #ccc;
}

.gacha-rate.rare {
    background: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.gacha-rate.epic {
    background: rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

.gacha-rate.legendary {
    background: rgba(234, 179, 8, 0.3);
    color: #facc15;
}

.gacha-rate.mythical {
    background: rgba(236, 72, 153, 0.3);
    color: #f472b6;
}

.gacha-rate .rate-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.gacha-rate.common .rate-dot {
    background: #888;
}

.gacha-rate.rare .rate-dot {
    background: #60a5fa;
}

.gacha-rate.epic .rate-dot {
    background: #c084fc;
}

.gacha-rate.legendary .rate-dot {
    background: #facc15;
}

.gacha-rate.mythical .rate-dot {
    background: #f472b6;
}

/* 가챠 결과 모달 */
.gacha-result-modal {
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.gacha-result-modal h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #ffd700;
}

.gacha-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

/* 단일 결과 (큰 카드) */
.gacha-results-grid.single-result {
    grid-template-columns: 1fr;
    max-width: 250px;
    margin: 0 auto 24px;
}

.gacha-result-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: card-reveal 0.5s ease-out forwards;
    opacity: 0;
    transform: scale(0.8) rotateY(90deg);
}

/* 가챠 결과 희귀도별 배경 그라데이션 */
.gacha-result-card.rarity-uncommon {
    background: linear-gradient(135deg, #f1f8e9, #81c784) !important;
}

.gacha-result-card.rarity-rare {
    background: linear-gradient(135deg, #e3f2fd, #64b5f6) !important;
}

.gacha-result-card.rarity-epic {
    background: linear-gradient(135deg, #f3e5f5, #ba68c8) !important;
}

.gacha-result-card.rarity-legendary {
    background: linear-gradient(135deg, #fff8e1, #ffb74d) !important;
    box-shadow: 0 4px 15px rgba(255, 183, 77, 0.3);
}

.gacha-result-card.rarity-mythical {
    background: linear-gradient(135deg, #fce4ec, #f06292) !important;
    box-shadow: 0 4px 15px rgba(240, 98, 146, 0.3);
}


.gacha-result-card:nth-child(1) {
    animation-delay: 0.1s;
}

.gacha-result-card:nth-child(2) {
    animation-delay: 0.2s;
}

.gacha-result-card:nth-child(3) {
    animation-delay: 0.3s;
}

.gacha-result-card:nth-child(4) {
    animation-delay: 0.4s;
}

.gacha-result-card:nth-child(5) {
    animation-delay: 0.5s;
}

.gacha-result-card:nth-child(6) {
    animation-delay: 0.6s;
}

.gacha-result-card:nth-child(7) {
    animation-delay: 0.7s;
}

.gacha-result-card:nth-child(8) {
    animation-delay: 0.8s;
}

.gacha-result-card:nth-child(9) {
    animation-delay: 0.9s;
}

.gacha-result-card:nth-child(10) {
    animation-delay: 1.0s;
}

@keyframes card-reveal {
    0% {
        opacity: 0;
        transform: scale(0.8) rotateY(90deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.1) rotateY(0deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

/* 희귀도별 테두리 */
.gacha-result-card.rarity-common {
    background: #ffffff !important;
    border: 2px solid #888;
}

.gacha-result-card.rarity-common .pokemon-name {
    color: #2c3e50 !important;
}

.gacha-result-card.rarity-common .pokemon-info {
    color: rgba(44, 62, 80, 0.9) !important;
}

/* 각 등급별 pokemon-name, pokemon-info 색상 조정 */
.gacha-result-card.rarity-uncommon .pokemon-name {
    color: rgba(27, 94, 32, 1) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.gacha-result-card.rarity-uncommon .pokemon-info {
    color: rgba(27, 94, 32, 0.9) !important;
}

.gacha-result-card.rarity-rare .pokemon-name {
    color: rgba(13, 71, 161, 1) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.gacha-result-card.rarity-rare .pokemon-info {
    color: rgba(13, 71, 161, 0.9) !important;
}

.gacha-result-card.rarity-epic .pokemon-name {
    color: rgba(74, 20, 140, 1) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.gacha-result-card.rarity-epic .pokemon-info {
    color: rgba(74, 20, 140, 0.9) !important;
}

.gacha-result-card.rarity-legendary .pokemon-name {
    color: rgba(133, 88, 0, 1) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.gacha-result-card.rarity-legendary .pokemon-info {
    color: rgba(133, 88, 0, 0.9) !important;
}

.gacha-result-card.rarity-mythical .pokemon-name {
    color: rgba(136, 14, 79, 1) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8) !important;
}

.gacha-result-card.rarity-mythical .pokemon-info {
    color: rgba(136, 14, 79, 0.9) !important;
}

.gacha-result-card.rarity-uncommon {
    border: 2px solid #81c784;
    box-shadow: 0 0 10px rgba(129, 199, 132, 0.3);
}

.gacha-result-card.rarity-rare {
    border: 2px solid #60a5fa;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.3);
}

.gacha-result-card.rarity-epic {
    border: 2px solid #c084fc;
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.4);
}

.gacha-result-card.rarity-legendary {
    border: 2px solid #facc15;
    box-shadow: 0 0 25px rgba(250, 204, 21, 0.5);
    animation: card-reveal 0.5s ease-out forwards, legendary-glow 2s ease-in-out infinite;
}

.gacha-result-card.rarity-mythical {
    border: 2px solid #f472b6;
    box-shadow: 0 0 30px rgba(244, 114, 182, 0.6);
    animation: card-reveal 0.5s ease-out forwards, mythical-glow 2s ease-in-out infinite;
}

@keyframes legendary-glow {

    0%,
    100% {
        box-shadow: 0 0 25px rgba(250, 204, 21, 0.5);
    }

    50% {
        box-shadow: 0 0 40px rgba(250, 204, 21, 0.8);
    }
}

@keyframes mythical-glow {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(244, 114, 182, 0.6);
    }

    50% {
        box-shadow: 0 0 50px rgba(244, 114, 182, 0.9);
    }
}

.gacha-result-card .pokemon-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}

.single-result .gacha-result-card .pokemon-image {
    width: 120px;
    height: 120px;
}

.gacha-result-card .pokemon-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.gacha-result-card .pokemon-info {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.gacha-result-card .iv-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.gacha-result-card .iv-badge.grade-S {
    background: #facc15;
    color: #1a1a2e;
}

.gacha-result-card .iv-badge.grade-A {
    background: #c084fc;
    color: #1a1a2e;
}

.gacha-result-card .iv-badge.grade-B {
    background: #60a5fa;
    color: #1a1a2e;
}

.gacha-result-card .iv-badge.grade-C {
    background: #888;
    color: #fff;
}

.gacha-result-card .shiny-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.2rem;
}

.gacha-result-card .guaranteed-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #22c55e;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.gacha-result-card .rarity-label {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.gacha-result-card .rarity-label.common {
    background: rgba(128, 128, 128, 0.8);
    color: #ffffff;
    font-weight: 700;
}

.gacha-result-card .rarity-label.uncommon {
    background: rgba(76, 175, 80, 0.9);
    color: #ffffff;
    font-weight: 700;
}

.gacha-result-card .rarity-label.rare {
    background: rgba(33, 150, 243, 0.9);
    color: #ffffff;
    font-weight: 700;
}

.gacha-result-card .rarity-label.epic {
    background: rgba(156, 39, 176, 0.9);
    color: #ffffff;
    font-weight: 700;
}

.gacha-result-card .rarity-label.legendary {
    background: rgba(255, 193, 7, 0.9);
    color: #1a1a2e;
    font-weight: 700;
}

.gacha-result-card .rarity-label.mythical {
    background: rgba(233, 30, 99, 0.9);
    color: #ffffff;
    font-weight: 700;
}

/* 가챠 연출 오버레이 */
#gacha-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#gacha-animation-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.animation-pokeball {
    width: 150px;
    height: 150px;
    position: relative;
    animation: big-shake 0.5s ease-in-out infinite;
}

.animation-pokeball .pokeball-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48%;
    background: linear-gradient(135deg, #ff5050, #cc0000);
    border-radius: 150px 150px 0 0;
    border-bottom: 8px solid #1a1a2e;
}

.animation-pokeball .pokeball-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48%;
    background: linear-gradient(135deg, #fff, #ddd);
    border-radius: 0 0 150px 150px;
}

.animation-pokeball .pokeball-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border: 6px solid #1a1a2e;
    border-radius: 50%;
    z-index: 10;
}

@keyframes big-shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-20deg);
    }

    40% {
        transform: rotate(20deg);
    }

    60% {
        transform: rotate(-15deg);
    }

    80% {
        transform: rotate(15deg);
    }
}

.animation-pokeball.burst {
    animation: pokeball-burst 0.5s ease-out forwards;
}

@keyframes pokeball-burst {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.animation-text {
    color: #fff;
    font-size: 1.5rem;
    margin-top: 24px;
    font-weight: bold;
}

/* 반응형 */
@media (max-width: 600px) {
    .gacha-container {
        padding: 12px;
    }

    .gacha-machine {
        width: 150px;
        height: 150px;
        margin-bottom: 24px;
    }

    .gacha-gold-display {
        padding: 10px 18px;
        font-size: 1.1rem;
        margin-bottom: 24px;
    }

    .gacha-buttons {
        flex-direction: column;
        align-items: center;
    }

    .gacha-btn {
        width: 90%;
        padding: 14px 24px;
    }

    .gacha-rates {
        padding: 12px;
        gap: 8px;
    }

    .gacha-rate {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .gacha-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gacha-result-card {
        padding: 12px 8px;
    }

    .gacha-result-card .pokemon-image {
        width: 60px;
        height: 60px;
    }

    .gacha-result-card .pokemon-name {
        font-size: 0.8rem;
    }

    .gacha-result-modal h2 {
        font-size: 1.4rem;
    }

    .animation-pokeball {
        width: 120px;
        height: 120px;
    }

    .animation-text {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .gacha-machine {
        width: 120px;
        height: 120px;
    }

    .gacha-btn {
        width: 100%;
        padding: 12px 20px;
        min-width: auto;
    }

    .gacha-btn .price {
        font-size: 0.75rem;
    }

    .gacha-rate {
        font-size: 0.75rem;
        padding: 3px 6px;
    }

    .gacha-result-card .pokemon-image {
        width: 50px;
        height: 50px;
    }

    .gacha-result-card .pokemon-name {
        font-size: 0.75rem;
    }

    .gacha-result-card .pokemon-info {
        font-size: 0.65rem;
    }
}

@media (max-width: 360px) {
    .gacha-machine {
        width: 100px;
        height: 100px;
    }

    .gacha-gold-display {
        font-size: 1rem;
        padding: 8px 14px;
    }

    .gacha-results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .gacha-result-card .pokemon-image {
        width: 45px;
        height: 45px;
    }
}