/**
 * 재미있는 번호 생성 애니메이션 스타일 v2
 */

/* ============================================
   모달 스타일
   ============================================ */
.fun-generator-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(8px);
}

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

.fun-generator-content {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: 24px;
    padding: 0;
    max-width: 420px;
    width: 92%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6),
                0 0 60px rgba(255, 215, 0, 0.08),
                inset 0 1px 0 rgba(255,255,255,0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid rgba(255,255,255,0.08);
}

.fun-generator-modal.active .fun-generator-content {
    transform: scale(1);
}

.fun-generator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0,0,0,0.2);
}

.fun-generator-title {
    margin: 0;
    font-size: 1.3rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.fun-generator-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.fun-generator-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.fun-generator-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fun-generator-canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.fun-generator-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: center;
    background: rgba(0,0,0,0.2);
}

/* ============================================
   버튼 스타일
   ============================================ */
.fun-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
}

.fun-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 시작 버튼 - 크고 눈에 띄게 */
.fun-btn-start {
    background: linear-gradient(135deg, #fbc400, #e5a800);
    color: #000;
    font-size: 1.1rem;
    padding: 16px 36px;
    box-shadow: 0 6px 20px rgba(251, 196, 0, 0.4);
    min-width: 180px;
}

.fun-btn-start:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffcf2d, #fbc400);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(251, 196, 0, 0.5);
}

.fun-btn-start:active:not(:disabled) {
    transform: translateY(-1px);
}

/* 다시 추첨 버튼 */
.fun-btn-retry {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fun-btn-retry:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* 저장 버튼 */
.fun-btn-save {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #000;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
}

.fun-btn-save:hover {
    background: linear-gradient(135deg, #5eea92, #4ade80);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

/* ============================================
   로또머신 스타일
   ============================================ */
.lotto-machine-canvas {
    border-radius: 50%;
    background: radial-gradient(circle, #2a2a4a 0%, #1a1a2e 100%);
    box-shadow: 0 0 30px rgba(255,215,0,0.1),
                inset 0 0 30px rgba(0,0,0,0.5);
}

.lotto-machine-result {
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 55px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 0;
}

.result-ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 17px;
    box-shadow: inset -3px -3px 6px rgba(0, 0, 0, 0.3),
                inset 3px 3px 6px rgba(255, 255, 255, 0.4),
                0 5px 15px rgba(0, 0, 0, 0.4);
    position: relative;
}

.result-ball.extracting {
    animation: ballExtract 0.35s ease-out forwards;
}

.result-ball.landed {
    animation: ballLand 0.25s ease-out forwards;
}

@keyframes ballExtract {
    0% {
        transform: translateY(-30px) scale(0.3);
        opacity: 0;
    }
    60% {
        transform: translateY(5px) scale(1.15);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes ballLand {
    0% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* ============================================
   우주 테마 스타일
   ============================================ */
.galaxy-canvas {
    border-radius: 18px;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3e 100%);
    box-shadow: 0 0 40px rgba(100,80,180,0.2),
                inset 0 0 40px rgba(0,0,0,0.5);
}

.galaxy-result {
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 50px;
    align-items: center;
    padding: 12px 0;
}

/* ============================================
   생성 방식 선택 버튼 (메인 페이지)
   ============================================ */
.fun-gen-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.fun-gen-btn {
    padding: 14px 24px;
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    color: #fbc400;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fun-gen-btn:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.1));
    border-color: rgba(255, 215, 0, 0.7);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.25);
}

.fun-gen-btn:active {
    transform: translateY(-1px);
}

.fun-gen-btn .icon {
    font-size: 1.4rem;
}

/* ============================================
   다크모드 지원
   ============================================ */
[data-theme="light"] .fun-generator-content {
    background: linear-gradient(145deg, #ffffff, #f0f0f5);
    border-color: rgba(0,0,0,0.1);
}

[data-theme="light"] .fun-generator-header {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .fun-generator-title {
    color: #333;
}

[data-theme="light"] .fun-generator-close {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(0,0,0,0.05);
}

[data-theme="light"] .fun-generator-close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .fun-generator-footer {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .fun-btn-retry {
    background: rgba(0, 0, 0, 0.06);
    color: #333;
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .fun-btn-retry:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .fun-gen-btn {
    background: linear-gradient(135deg, rgba(251, 196, 0, 0.2), rgba(251, 196, 0, 0.08));
    border-color: rgba(251, 196, 0, 0.5);
    color: #b38600;
}

[data-theme="light"] .fun-gen-btn:hover {
    background: linear-gradient(135deg, rgba(251, 196, 0, 0.3), rgba(251, 196, 0, 0.15));
    border-color: rgba(251, 196, 0, 0.8);
}

[data-theme="light"] .lotto-machine-canvas {
    background: radial-gradient(circle, #e8e8f0 0%, #d0d0e0 100%);
}

[data-theme="light"] .galaxy-canvas {
    /* 우주 테마는 항상 어두운 배경 유지 */
}

/* ============================================
   반응형
   ============================================ */
@media (max-width: 420px) {
    .fun-generator-content {
        width: 96%;
        max-width: none;
        border-radius: 20px;
    }

    .fun-generator-header {
        padding: 16px 20px;
    }

    .fun-generator-body {
        padding: 20px 16px;
    }

    .fun-generator-footer {
        padding: 16px 20px;
        flex-wrap: wrap;
    }

    .lotto-machine-canvas {
        width: 280px !important;
        height: 280px !important;
    }

    .galaxy-canvas {
        width: 320px !important;
        height: 290px !important;
    }

    .result-ball {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .fun-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
        min-width: 120px;
    }

    .fun-btn-start {
        width: 100%;
        padding: 14px 24px;
    }

    .fun-gen-buttons {
        flex-direction: column;
    }

    .fun-gen-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
}

/* ============================================
   애니메이션 보조
   ============================================ */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(251, 196, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(251, 196, 0, 0);
    }
}

.fun-btn-start:not(:disabled) {
    animation: pulse 2s infinite;
}

.fun-btn-start:hover:not(:disabled) {
    animation: none;
}
