/* 공통 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
}

body.user-profile-modal-open {
    overflow: hidden;
}

/* 공통 버튼 스타일 */
button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.user-profile-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 20, 0.55);
    backdrop-filter: blur(4px);
    z-index: 2600;
    padding: 1.5rem;
}

.user-profile-modal.show {
    display: flex;
}

.user-profile-card {
    position: relative;
    width: min(340px, 90vw);
    background: rgba(12, 16, 28, 0.95);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    padding: 1.75rem 1.5rem 1.5rem;
    color: #f5f7ff;
    overflow: hidden;
}

.user-profile-card.is-loading {
    opacity: 0.85;
}

.user-profile-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.user-profile-close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.05);
}

.user-profile-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    /* margin-bottom: 1.5rem; */
    text-align: center;
}

.user-profile-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 2.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.user-profile-avatar.has-image {
    padding: 0;
}

.user-profile-avatar.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
}

.user-profile-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.user-profile-title {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}

.user-profile-joined {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.62);
    margin: 0;
}

.user-profile-loading {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
}

.user-profile-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: rgba(255, 255, 255, 0.85);
    animation: userProfileSpinner 0.8s linear infinite;
}

.user-profile-error {
    display: none;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #ff8a80;
}

.user-profile-trigger {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    outline: none;
}

.user-profile-trigger:hover {
    opacity: 0.9;
}

.user-profile-trigger:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.55);
    outline-offset: 2px;
}

@keyframes userProfileSpinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 공통 카드 스타일 */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: #333;
}

/* 게임 카드 공통 스타일 */
.common-card h4,
.my-card h4,
.pack-result-card h4 {
    text-align: left !important;
    font-size: 1rem !important;
    margin: 0 !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
    flex: 1 !important;
    padding-right: 8px !important;
}

/* SS급 카드 빛나는 효과 */
.ss-shine-effect {
    position: relative;
    overflow: hidden;
}

.ss-shine-effect::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 0%, 
        transparent 30%, 
        rgba(255, 255, 255, 0.6) 50%, 
        transparent 70%, 
        transparent 100%);
    animation: ssShine 3s ease-in-out infinite;
    z-index: 999;
    pointer-events: none;
    mix-blend-mode: overlay;
}

@keyframes ssShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
    100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}

/* SS급 카드의 텍스트 요소들이 빛 효과와 잘 조화되도록 */
.ss-shine-effect h4,
.ss-shine-effect span {
    position: relative;
    z-index: 1000;
}

/* 카드 레이아웃 통일 */
.common-card,
.my-card,
.pack-result-card {
    width: 200px !important;
    height: 320px !important;
    aspect-ratio: 5/8 !important;
    border-radius: 15px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.3s ease !important;
    margin: 0 auto !important;
}

/* 새 카드 (카드팩 뽑기 결과) 크기 */
.common-card.new-card-size {
    width: 250px !important;
    height: 400px !important;
    aspect-ratio: 5/8 !important;
}

/* 카드 크기는 모든 해상도에서 고정, 정렬만 반응형 */

.common-card:hover,
.my-card:hover,
.pack-result-card:hover {
    transform: translateY(-5px) scale(1.02) !important;
}

/* 에러 메시지 */
.error-message, .error-text {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: bold;
}

/* 페이지 헤더 */
.page-header {
    background: rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.back-btn {
    color: white;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.3s ease;
}

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

/* 로딩 애니메이션 */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 코인 업데이트 애니메이션 */
@keyframes coinUpdate {
    0% { transform: scale(1); }
    50% { 
        transform: scale(1.1);
        color: #ffd700;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    100% { transform: scale(1); }
}

/* ===== 통일된 페이지 컨테이너 시스템 ===== */
.page-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
}

.page-main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 메인 페이지는 특별한 레이아웃 */
.main-page-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 반응형 컨테이너 */
@media (max-width: 768px) {
    .page-main-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .page-main-content {
        padding: 0.75rem;
    }
}

/* ===== 통일된 헤더 시스템 ===== */
.unified-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 70px;
}

.header-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.unified-header .page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.unified-header .back-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.unified-header .back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.header-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.header-stat.coin {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 152, 0, 0.2));
    border-color: rgba(255, 193, 7, 0.3);
}

.header-stat.premium-ticket {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(129, 140, 248, 0.2));
    border-color: rgba(129, 140, 248, 0.35);
}

.header-stat.energy {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(3, 169, 244, 0.2));
    border-color: rgba(33, 150, 243, 0.3);
}

.header-stat.count {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(139, 195, 74, 0.2));
    border-color: rgba(76, 175, 80, 0.3);
}

.header-stat.round {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2));
    border-color: rgba(255, 255, 255, 0.3);
}

.header-action-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.header-action-btn:hover {
    background: linear-gradient(135deg, #f7931e, #ff6b35);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 107, 53, 0.4);
}

/* 반응형 */
@media (max-width: 768px) {
    .page-header {
        padding: 1rem;
    }
    
    .header-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .unified-header {
        padding: 0.75rem 1rem;
        min-height: 60px;
    }
    
    .unified-header .page-title {
        font-size: 1.2rem;
    }
    
    .header-info {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .header-stat {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .header-action-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    .unified-header .back-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .unified-header {
        padding: 0.5rem !important;
        flex-wrap: wrap !important;
        min-height: auto !important;
    }
    
    .header-center {
        order: -1 !important;
        flex-basis: 100% !important;
        margin-bottom: 0.5rem !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    .header-left {
        flex: 1 !important;
        order: 0 !important;
        width: auto !important;
        justify-content: flex-start !important;
    }
    
    .header-right {
        flex: 0 0 auto !important;
        order: 1 !important;
        margin-left: auto !important;
        width: auto !important;
        justify-content: flex-end !important;
        align-self: flex-end !important;
    }
    
    .header-info {
        gap: 0.25rem !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
    }
    
    .header-stat {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
        white-space: nowrap !important;
    }
}
