/* Version: 2.2.0 - Updated: 2025-09-02 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 법적 안내 링크 스타일 */
.legal-notice-link {
    color: #888;
    text-decoration: underline;
    transition: color 0.2s;
}

.legal-notice-link:hover {
    color: #667eea;
}

/* 초기 로딩 시 모든 섹션 숨김 (JavaScript로 제어) */
body:not(.auth-initialized) #loginSection,
body:not(.auth-initialized) #uploadSection,
body:not(.auth-initialized) #resultSection,
body:not(.auth-initialized) #headerUser {
    display: none;
}

/* 점검 중 오버레이 스타일 */
.maintenance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(10px);
}

.maintenance-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    margin: 20px;
}

.maintenance-icon {
    width: 80px;
    height: 48px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.maintenance-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.maintenance-message {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.maintenance-time {
    font-size: 14px;
    color: #999;
    margin-top: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;  /* PC에서 배경색 */
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: visible;
    height: auto;
    min-height: auto;
    display: flex;
    flex-direction: column;
    width: 100vw;
    max-width: 100vw;
    position: static;
    /* 모바일 확대 방지 */
    touch-action: pan-y;  /* 세로 스크롤만 허용, 핀치 줌 방지 */
    /* 모바일에서 스크롤 성능 향상 */
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* 모바일에서 레이아웃 안정화 */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 초기 로딩 중 레이아웃 안정화 */
/* initialLoading은 항상 보이도록 유지 */
#initialLoading {
    z-index: 99999;
}

/* 컨텐츠는 초기 로딩 중 숨김 */
body:not(.auth-initialized) .container,
body:not(.auth-initialized) .header {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.auth-initialized .container,
body.auth-initialized .header {
    opacity: 1;
}

/* 초기 로딩 중 LNB 상태 고정 */
body:not(.auth-initialized) .lnb {
    width: 68px;
    transition: none;
}

body:not(.auth-initialized) .lnb-text,
body:not(.auth-initialized) .lnb-bottom-menu {
    display: none;
}

/* LNB 상태 강제 초기화 - 모바일 기준으로 통일 */
body:not(.lnb-open) .lnb {
    transform: translateX(-100%);
}

/* 오버레이는 active 클래스로만 제어 */
/* body:not(.lnb-open) .mobile-overlay {
    display: none;
} */

/* 로그인 상태로 페이지 접근 시 body 스타일 강제 초기화 */
body:not(.lnb-open) {
    position: static;
    width: auto;
    overflow: visible;
    top: auto;
}

/* body 높이 자동 조정 - 모바일 기준으로 통일 (위에서 통합됨) */

/* input 포커스 시 줌 방지 - 모바일 기준으로 통일 */
input, textarea, select {
    font-size: 16px; /* iOS에서 16px 미만일 때 자동 줌 방지 */
    touch-action: manipulation;
}

/* 콘텐츠 래퍼 - 모바일 기준으로 통일 */
.content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    align-items: stretch;
    min-height: calc(100vh - 48px);
    margin: 0;
    margin-top: 48px; /* 헤더 높이만큼 상단 여백 추가 */
    overflow-x: hidden;
    background: white; /* 흰색 배경 */
}

/* 아이패드 및 태블릿 대응 */
@media screen and (min-width: 768px) and (min-height: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;  /* 세로 스크롤 허용 */
        display: flex;
        padding: 0;
    }
    
    .content-wrapper {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: stretch; /* 전체 너븄 사용 */
        margin-top: 0; /* 상단 마진 제거 */
    }
    
    .container {
        margin: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .global-stats {
        /* container 바로 아래 위치 */
        margin: 10px auto;
    }
}

/* 레이아웃 기본 구조 - 위에서 통합됨 */

/* LNB 상태에 따른 컨텐츠 위치 조정 (PC에서만) */
@media (min-width: 769px) {
    .main-wrapper:not(.lnb-expanded) .content-wrapper {
        margin-left: 0; /* LNB 접힌 상태에서도 마진 제거 */
    }
    
    .main-wrapper.lnb-expanded .content-wrapper {
        margin-left: 0; /* LNB 확장 상태에서도 마진 제거 */
    }
    
    /* PC에서 헤더는 항상 전체 너비 유지 */
    /* 헤더가 relative이므로 left/width 조정 불필요 */
}

/* 모바일에서는 LNB 공간 제거 */
@media (max-width: 768px) {
    .content-wrapper {
        margin-left: 0;
        width: 100%;
        height: auto;
        min-height: auto;
        overflow-y: visible;
    }
    
    .header {
        position: relative;
        left: 0;
        width: 100%;
    }
    
    /* 모바일에서 main-wrapper 전체 너비 사용 */
    .main-wrapper {
        width: 100%;
        margin-left: 0;
        height: auto;
        overflow: visible;
    }
    
    /* 모바일에서 인증 로딩 위치 안정화 */
    #authLoading {
        position: relative;
        z-index: 10;
        flex-shrink: 0;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: auto;
    }
    
    /* 모바일에서 LNB 스타일 */
    .lnb {
        position: fixed;
        left: 0;
        top: 0; /* 헤더 포함 전체 화면 */
        bottom: 0;
        width: 280px; /* 모바일에서 더 넓게 */
        height: 100vh;
        height: 100dvh; /* 동적 viewport 높이 사용 */
        background: white;
        border-right: 1px solid #e5e7eb;
        transform: translateX(-100%); /* 기본적으로 숨김 */
        transition: transform 0.3s ease;
        z-index: 10002; /* 오버레이보다 위에 표시 */
        display: flex;
        flex-direction: column;
        overflow-y: auto; /* LNB 내부는 스크롤 가능 */
        -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
    }
    
    .lnb.mobile-open {
        transform: translateX(0); /* 모바일에서 열릴 때 */
    }
    
    /* LNB 열렸을 때 body 스크롤 방지 */
    body.lnb-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* 모바일 LNB 닫기 버튼 */
.lnb-close.mobile-only {
    display: none; /* PC에서는 숨김 */
}

@media (max-width: 768px) {
    .lnb-close.mobile-only {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: none;
        cursor: pointer;
        color: #374151;
        margin: 10px auto;
        border-radius: 8px;
        transition: background 0.2s;
    }
    
    .lnb-close.mobile-only:hover {
        background: #f3f4f6;
    }
}

/* LNB 스타일 */
.lnb {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 68px; /* 아이콘 24px + 마진 12px*2 + 패딩 */
    height: 100%;
    max-height: 100vh;
    max-height: -webkit-fill-available; /* iOS Safari 대응 */
    background: white;
    border-right: 1px solid #e5e7eb;
    transition: width 0.3s ease;
    z-index: 10003; /* 모바일 오버레이(10001)보다 위에 위치하도록 수정 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 기본적으로 오버플로우 숨김 */
    /* 모바일에서 스크롤 시 떨림 방지 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

.lnb.expanded {
    width: 272px; /* 확장 시 너비 */
}

.lnb-header {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 왼쪽 정렬 */
    height: 48px; /* 고정 높이 설정 */
}

.lnb-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #374151;
    margin-top: 4px;
    outline: none;
    transition: opacity 0.2s;
}

.lnb-toggle:hover {
    opacity: 0.7;
}

.lnb-toggle:focus {
    outline: none;
}

.lnb-menu {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    min-height: 0; /* flex 아이템이 축소될 수 있도록 */
}

.lnb-bottom-menu {
    padding: 12px;
    padding-bottom: 20px; /* 하단 패딩 증가 */
    margin-top: auto;
    margin-bottom: 30px; /* 하단 마진 증가 - 더 위로 올림 */
    border-top: 1px solid #e5e7eb;
}

.lnb-bottom-menu .lnb-item {
    padding: 10px 12px; /* 패딩 약간 증가 */
    margin-bottom: 4px; /* 버튼 간격 증가 */
    font-size: 14px; /* 폰트 크기 약간 증가 */
}

.lnb-bottom-menu .lnb-icon {
    width: 22px; /* 아이콘 크기 약간 증가 */
    height: 22px;
}

/* 사용자 정보 스타일 */
.lnb-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.user-avatar {
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* LNB 접힌 상태에서 사용자 정보 숨기기 */
.lnb:not(.expanded) .lnb-user-info {
    display: none;
}

.lnb-footer {
    padding: 12px;
    margin-top: auto;
    flex-shrink: 0; /* 축소되지 않도록 */
    background: white; /* 배경색 지정 */
}

.lnb-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 10px 10px 10px; /* 왼쪽 패딩을 16px로 설정하여 아이콘 위치 고정 */
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: #6b7280;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.lnb-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.lnb-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.lnb-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.lnb-footer .lnb-icon {
    width: 24px;
    height: 24px;
}

.lnb-text {
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* LNB 펼쳐져도 아이콘 위치는 동일하게 유지 */

.lnb.expanded .lnb-text {
    opacity: 1;
    width: auto;
}

/* LNB - 모바일 기준으로 통일 */
.lnb {
    width: 272px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10003;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
    
    .lnb.mobile-open {
        transform: translateX(0);
    }
    
    .lnb .lnb-text {
        opacity: 1;
        width: auto;
    }
    
    .lnb-item {
        justify-content: flex-start;
    }
    
    .lnb-menu {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* 메뉴 상단 정렬 */
        gap: 11px;
        padding: 11px;
        padding-bottom: 100px; /* footer를 위한 하단 패딩 추가 */
        min-height: 0; /* flex 아이템이 축소될 수 있도록 */
        overflow-y: auto; /* 메뉴가 많을 경우 스크롤 */
        overflow-x: hidden;
    }
    
    .lnb-footer {
        position: absolute; /* fixed에서 absolute로 변경 */
        bottom: 0;
        left: 0; /* LNB 내부에서 위치 */
        right: 0;
        width: 100%; /* LNB 너비에 맞춤 */
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* iOS 홈 인디케이터 영역 고려 */
        background: white; /* 배경색 추가하여 스크롤 시에도 보이게 */
        border-top: 1px solid #e5e7eb; /* 구분선 추가 */
        z-index: 10; /* 다른 요소 위에 표시 */
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); /* 그림자 추가로 구분 강화 */
    }
    
    /* LNB footer는 이제 absolute이므로 이 스타일 불필요 */
}

/* 컨테이너 위치 조정 */
.container {
    background: white;
    border-radius: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-shadow: none;
    margin: 0;
    position: relative;
    z-index: 1;
    min-height: auto; /* 컨테이너는 내용만큼만 */
    display: flex;
    flex-direction: column;
    flex: 1; /* 남은 공간 차지 */
}

/* 컨테이너 내부 요소들의 마진 설정 */
.container > * {
    margin-left: 20px;
    margin-right: 20px;
}

/* global-stats와 footer는 좌우 마진 제거하여 꽉 차게 */
.container > .global-stats,
.container > .footer {
    margin-left: 0;
    margin-right: 0;
}

/* 모바일에서 container 상단 마진 추가 */
@media (max-width: 768px) {
    .container {
        padding: 0;
        margin-top: 25px; /* 모바일에서 상단 여백 증가 */
    }
    
    .container > * {
        margin-left: 15px;
        margin-right: 15px;
    }
    
    /* global-stats와 footer는 좌우 마진 제거하여 꽉 차게 */
    .container > .global-stats,
    .container > .footer {
        margin-left: 0;
        margin-right: 0;
    }
}

/* PC에서도 container 상단 마진 추가 */
@media (min-width: 769px) {
    .container {
        margin-top: 30px; /* PC에서 상단 여백 증가 */
    }
    
    .container > * {
        margin-left: 30px;
        margin-right: 30px;
    }
    
    /* global-stats와 footer는 좌우 마진 제거하여 꽉 차게 */
    .container > .global-stats,
    .container > .footer {
        margin-left: 0;
        margin-right: 0;
    }
}

/* 모바일 기준으로 통일 - 모든 미디어 쿼리 제거 */

.header {
    left: 0;
    width: 100%;
}

/* 햄버거 버튼 - 항상 표시 */
.mobile-menu-btn {
    display: flex;
    position: fixed;
    left: 15px;
    z-index: 1003;
    top: 4px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #374151;
    outline: none;
    transition: opacity 0.2s;
    /* 스크롤 시 떨림 방지 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

.mobile-menu-btn:hover {
    opacity: 0.7;
}

.mobile-menu-btn:focus {
    outline: none;
}
    
/* 오버레이 - 모든 디바이스에서 작동 */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10002; /* LNB(10003)보다 약간 낮게 설정 */
    cursor: pointer;
}

.mobile-overlay.active {
    display: block;
    pointer-events: auto; /* 클릭 가능하게 활성화 */
}
    
    .container {
        padding: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: auto;
        flex: 1; /* 남은 공간 차지 */
    }
    
    .content-wrapper {
        width: 100%;
        margin: 0;
    }
}

@media (min-width: 540px) {
    .container {
        width: 100%;
        margin: 0; /* 모든 마진 제거 */
    }
}

@media (max-width: 400px) {
    .container {
        min-width: 100%; /* 작은 화면에서도 100% */
    }
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.subtitle {
    text-align: center;
    color: #999;
    margin-bottom: 20px;
}

.global-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 25px;
    margin: 10px 0 10px 0; /* 좌우 마진 제거하여 꽉 차게 */
    width: 100%;
    max-width: none; /* 최대 너비 제한 해제 */
    font-size: 16px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

@media (min-width: 540px) {
    .global-stats {
        width: 100%;
        max-width: none; /* 최대 너비 제한 해제 */
        margin: 5px 0 10px 0; /* 좌우 마진 제거 */
    }
}

/* 모바일에서 가로 사이즈 조정 */
@media (max-width: 520px) {
    .global-stats {
        font-size: 14px;
        padding: 10px 15px;
        white-space: normal; /* 긴 텍스트 줄바꿈 허용 */
    }
}

/* 메모리얼 섹션 */
.memorial-section {
    text-align: center;
    padding: 0 10px;
    margin-bottom: 10px;
    max-width: 500px;
    width: 100%;
}

.memorial-section.hidden {
    display: none;
}

.memorial-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

.memorial-text {
    font-size: 18px;
    color: #333;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@media (max-width: 520px) {
    .memorial-image {
        max-width: 100%;
    }
    .memorial-text {
        font-size: 16px;
    }
}

.global-stats span {
    font-weight: bold;
    color: #ffd700;
}

.login-section {
    text-align: center;
    padding: 0 20px;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 900px;
    width: 100%;
    background: #f8f9fa;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* 모바일에서 login-section 스타일 */
@media (max-width: 768px) {
    .login-section {
        max-width: 100%;
        padding: 0 15px;
        margin: 30px auto;
    }
    
    .login-section h2 {
        font-size: 24px;
    }
    
    .login-section p {
        font-size: 14px;
    }
}

.google-btn {
    width: 100%;
    height: 48px;
    background: #FFFFFF;
    border: 1px solid #DADCE0;
    border-radius: 12px;
    padding: 0 16px 0 48px; /* 왼쪽: 아이콘 공간(48px), 오른쪽: 패딩(16px) */
    font-size: 15px;
    font-weight: 500;
    color: #3C4043;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.google-btn:hover:not(:disabled) {
    background: #F8F9FA;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
}

.google-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.kakao-btn {
    width: 100%;
    min-width: 280px;
    height: 48px;
    background: #FEE500;
    border: none;
    border-radius: 12px;
    padding: 0 24px 0 52px; /* 왼쪽: 아이콘 공간(52px), 오른쪽: 일반 패딩(24px) */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.kakao-btn:hover:not(:disabled) {
    background: #FDD835;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
}

.kakao-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* 미리보기 버튼 스타일 */
.preview-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    z-index: 1000;
    transition: all 0.2s;
}

.preview-btn:hover {
    opacity: 0.9;
    transform: scale(0.98);
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 10005; /* LNB(10002)보다 위에 표시 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    animation: fadeIn 0.3s;
    justify-content: center;
    align-items: center;
}

/* 모달 열릴 때 body 스크롤 방지 */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #667eea;
}

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

/* 이미지 우클릭 방지 */
img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    pointer-events: auto;
}

.google-btn img {
    width: 20px;
    height: 20px;
}

/* 사용자 정보 - 우측 상단 */
.user-info {
    position: fixed;
    top: 20px;
    right: 20px;  /* 오른쪽 끝에 위치 */
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 4px 8px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
}

.user-info img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #4F46E5;
}

.user-info .user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0;
}


.logout-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: scale(0.98);
}

.history-btn:hover {
    opacity: 0.9;
    transform: scale(0.98);
}

/* 아이패드에서 user-info 위치 조정 */
@media screen and (min-width: 768px) and (min-height: 768px) {
    .user-info {
        top: 30px;
        right: 30px;
    }
}

.upload-section {
    /* display controlled by JavaScript */
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* 모바일에서 upload-section 너비 확대 */
@media (max-width: 768px) {
    .upload-section {
        max-width: 100%;
        padding: 0 15px;
    }
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 300px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #fafafa;
}

/* 모바일에서 upload-area 크기 조정 */
@media (max-width: 768px) {
    .upload-area {
        padding: 50px 20px;
        min-height: 250px;
        width: 100%;
    }
    
    .usage-info {
        padding: 12px 15px;
        margin: 10px 10px;
    }
    
    /* 모바일에서 모달 최적화 */
    #legalModal, #bugReportModal {
        align-items: flex-start;
        padding: 10px;
        padding-top: 5vh;
    }
    
    #legalModal > div, #bugReportModal > div {
        max-height: 85vh;
        width: calc(100vw - 20px);
        max-width: none;
        margin: 0 auto;
        transform: none;
        border-radius: 12px;
        padding: 20px;
    }
    
    /* 모바일에서 모달 내부 스크롤 최적화 */
    #legalModal > div, #bugReportModal > div {
        -webkit-overflow-scrolling: touch;
    }
}

.upload-area:hover {
    border-color: #4285f4;
    background: #f0f7ff;
}

.upload-area.dragover {
    border-color: #4285f4;
    background: #e3f2fd;
}

#preview {
    max-width: 100%;
    max-height: 420px;  /* 이미지 미리보기 크게 표시 */
    border-radius: 10px;
    display: none;
    object-fit: contain;  /* 이미지 비율 유지 */
}

.style-options {
    margin-top: 20px;
    display: none;
}

.option-group {
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.option-group h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.option-grid.size-grid {
    grid-template-columns: repeat(3, 1fr);
}

.option-grid.color-grid {
    grid-template-columns: repeat(3, 1fr);
}

.style-option {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    font-size: 13px;
    background: white;
}

.style-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.style-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.color-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.size-preview {
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
}

.generate-btn:hover {
    background: #3367d6;
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.usage-info {
    margin : 10px 0 10px 0;
    text-align: center;
    padding: 10px 20px;
    background: #fff3cd;
    border-radius: 8px;
    color: #856404;
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.usage-info.no-remaining {
    background: #fee2e2;
    color: #991b1b;
}

.upload-area.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.upload-area.disabled:hover {
    border-color: #e5e7eb;
}

.result-section {
    display: none;
    text-align: center;
}

.result-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    min-height: 400px;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.result-image {
    max-width: 90%;
    max-height: 600px;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    object-fit: contain;
    display: block;
}

.download-btn {
    padding: 16px 32px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 5px;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.new-photo-btn {
    padding: 16px 32px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 5px;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.new-photo-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* PC에서 LNB가 열려있을 때 로딩 위치 조정 */
@media (min-width: 769px) {
    body.lnb-expanded .loading {
        left: 136px; /* LNB 너비의 절반만큼 이동하여 콘텐츠 영역 중앙에 위치 */
    }
}

.loading-content {
    background: white;
    border-radius: 16px;
    padding: 32px 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 320px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

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

.loading-text {
    font-size: 16px;
    color: #1f2937;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.loading-subtext {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

/* 인라인 스피너 (버튼용) */
.spinner-inline {
    display: inline-block;
    border: 2px solid rgba(0,0,0,0.1);
    border-top: 2px solid currentColor;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 푸터 스타일 */
.footer {
    padding: 1rem 0;
    text-align: center;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: auto; /* 자동 마진으로 항상 하단 푸시 */
    width: 100%;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .footer {
        padding: 1rem 0;
    }
}

/* main-wrapper 마진 조정 - LNB 확장 시 */
@media (min-width: 769px) {
    .main-wrapper.lnb-expanded {
        margin-left: 272px;
        width: calc(100% - 272px);
    }
    
    .main-wrapper {
        transition: margin-left 0.3s ease, width 0.3s ease;
    }
    
    /* PC에서도 햄버거 버튼 표시 - 모바일 기준으로 통일 */
}

/* 햄버거 버튼 - 모든 디바이스에서 표시 */

/* main-wrapper - 모바일 기준으로 통일, PC에서 최대 너비 제한 */
.main-wrapper {
    display: flex;
    flex-direction: column;
    margin: 0 auto; /* 중앙 정렬 */
    width: 100%; /* 기본 너비 100% */
    max-width: 480px; /* PC에서 최대 너비 제한 (모바일 크기) */
    min-height: 100vh;
    overflow: visible;
    background: white; /* PC에서 배경색 지정 */
    box-shadow: 0 0 20px rgba(0,0,0,0.1); /* PC에서 그림자 효과 */
}

/* main-wrapper - 모바일 기준으로 통일 */

/* 헤더 스타일 - 모바일 기준으로 통일 */
.header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    background: white; /* 흰색 배경 */
    z-index: 2001;
    transition: all 0.3s ease;
    padding: 0;
    height: 48px;
    display: flex;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid #e5e5e5; /* 하단 경계선 */
    /* 스크롤 시 떨림 방지 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* 헤더 위치 조정 제거 - 모바일 기준으로 통일 */



.header-content {
    max-width: 100%; /* 전체 너비 사용 */
    margin: 0;
    padding: 15px; /* 모바일 기준 패딩 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%; /* 전체 높이 사용 */
    width: 100%;
}

.header-logo {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.5px;
    line-height: 36px;
}

.logo-mobile {
    display: none;
}

/* 로고 컨테이너 - 모바일 기준 */
.logo-container-center {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

/* 모바일 기준으로 통일 - 미디어 쿼리 제거 */
.logo-full {
    display: none;
}
.logo-mobile {
    display: inline;
}

/* 헤더 로고 크기 */
.header-logo {
    font-size: 16px;
    font-weight: 700;
}

/* 모바일 메뉴 컨테이너 - 항상 표시 */
.mobile-menu-container {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-nav a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: #667eea;
}

.header-user {
    position: relative;
}

.header-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
}

.header-user-avatar:hover {
    transform: scale(1.05);
}

.header-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 8px;
    min-width: 160px;
    display: none;
    z-index: 1000;
}

.header-dropdown.show {
    display: block;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-dropdown button {
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-align: left;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-dropdown button:hover {
    background: #f5f5f5;
}

.header-dropdown .divider {
    height: 1px;
    background: #e5e5e5;
    margin: 4px 0;
}

.footer-content {
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

@media (min-width: 1024px) {
    .footer-content {
        padding: 0;
    }
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0;
    font-size: 0.75rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #1f2937;
}

.footer-copyright {
    font-size: 0.75rem;
    color: #9ca3af;
}

.footer-divider {
    color: #9ca3af;
    margin: 0 0.5rem;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 5px;
    margin: 20px 0;
    display: none;
}

/* 초기 로딩 상태 */
.auth-loading {
    text-align: center;
    padding: 40px 20px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-radius: 16px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.auth-loading .spinner {
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: auth-spin 1.2s linear infinite;
    margin: 0 auto 24px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

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

.auth-loading p {
    color: #555;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    letter-spacing: -0.02em;
}

/* 부드러운 전환 효과 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* 사용 가능 횟수 표시 */
.usage-limit-display {
    text-align: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    margin: 15px auto;
    font-size: 14px;
    font-weight: 500;
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* 이미지 우클릭 방지 */
img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    pointer-events: auto;
}

/* SANAI 로고 - 좌측 상단 */
.logo-container {
    display: none; /* 헤더 사용으로 제거 */
}

.logo-sanai {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.logo-sanai:hover {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* 토스트 메시지 스타일 */
.toast {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(33, 33, 33, 0.95);
    color: white;
    padding: 16px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    min-width: 200px;
    text-align: center;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
}

.toast.error {
    background: rgba(239, 68, 68, 0.95);
}

.toast.success {
    background: rgba(34, 197, 94, 0.95);
}

.toast.info {
    background: rgba(59, 130, 246, 0.95);
}

/* 이미지 결과 반응형 디자인 */
@media (max-width: 768px) {
    .result-image-container {
        padding: 15px;
        min-height: 300px;
    }
    
    .result-image {
        max-width: 100%;
        max-height: 500px;
    }
}

@media (max-width: 480px) {
    .result-image-container {
        padding: 10px;
        min-height: 250px;
        background: transparent;
    }
    
    .result-image {
        max-width: 100%;
        max-height: 400px;
        border-radius: 8px;
    }
}

/* 비디오 컨테이너 스타일 */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    z-index: 1;
    margin: 0;
    padding: 0;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

.placeholder-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

.video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center middle;
    z-index: 1;
    min-width: 100%;
    min-height: 100%;
    max-width: 100%;
    max-height: 100%;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 3;
    display: none;
}

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