/* ================================
   성서 히브리어 단어장 - 메인 스타일
   기본 스타일, 변수, 타이포그래피
   ================================ */

/* ================================
   1. CSS 변수
   ================================ */

:root {
    /* 색상 변수 */
    --text-color: #ffffff;
    --bg-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* 글라스모피즘 변수 */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-hover-bg: rgba(255, 255, 255, 0.15);
    --glass-active-bg: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --glass-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
    
    /* 네비게이션 */
    --bottom-nav-height: 60px;
}

[data-theme="dark"] {
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-hover-bg: rgba(255, 255, 255, 0.12);
    --glass-active-bg: rgba(255, 255, 255, 0.18);
}

/* ================================
   2. 글로벌 리셋 & 기본 스타일
   ================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 모바일 성능 최적화 */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    .card,
    .stat-card,
    .bottom-sheet,
    .mode-card,
    button {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
    }
    
    /* 모바일에서 backdrop-filter 성능 최적화 */
    .bottom-sheet,
    .sheet-overlay {
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    /* 새로고침 방지 (PULL TO REFRESH DISABLE) */
    overscroll-behavior-y: contain; 
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================================
   3. 타이포그래피
   ================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-color);
}

h1 {
    font-size: 1.8rem;
    text-align: center;
    margin: 0;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

/* 히브리어 폰트 */
.hebrew-word,
.word-hebrew-list {
    font-family: 'Frank Ruhl Libre', serif;
    direction: rtl;
}

/* ================================
   4. 스크롤바 스타일
   ================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ================================
   5. 공통 애니메이션
   ================================ */

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

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================================
   6. 로딩 화면 (타이포그래피 & 애니메이션)
   ================================ */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    animation: fadeIn 0.8s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -80px; /* 카드 위치와 맞추기 위해 약간 위로 */
}

/* 빛나는 알렙 로고 */
.loading-logo-symbol {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 8rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 
                 0 0 40px rgba(255, 255, 255, 0.3);
    animation: breathe 3s ease-in-out infinite;
}

/* 로딩 로고 이미지 */
.loading-logo-img {
    width: 700px;
    max-width: 90vw;
    height: auto;
    margin-bottom: 30px;
    animation: breathe 3s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9))
            drop-shadow(0 0 6px rgba(255, 255, 255, 0.7))
            drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
        text-shadow: 0 0 40px rgba(255, 255, 255, 0.8),
                     0 0 60px rgba(255, 255, 255, 0.4);
    }
}

.loading-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 1px;
    background: linear-gradient(to right, #fff, #e2e2e2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loading-sub {
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 40px;
    letter-spacing: 0.5px;
    font-weight: 300;
}

/* 모던한 로딩 점 애니메이션 */
.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    opacity: 0.2;
    animation: dots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dots {
    0%, 80%, 100% { transform: scale(0); opacity: 0.2; }
    40% { transform: scale(1); opacity: 1; }
}

/* ================================
   7. 모드 선택 화면
   ================================ */

.mode-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 9998;
}

.mode-content {
    max-width: 600px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.mode-logo {
    margin-bottom: 40px;
}

.mode-logo-img {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

.mode-logo h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.mode-logo p {
    opacity: 0.8;
    font-size: 1rem;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mode-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mode-card:hover {
    background: var(--glass-hover-bg);
    transform: translateY(-5px);
    box-shadow: var(--glass-shadow-hover);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.mode-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.mode-card p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.mode-tag {
    display: inline-block;
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
}

.mode-footer {
    opacity: 0.7;
    font-size: 0.9rem;
}

/* ================================
   8. XP 토스트 알림
   ================================ */

.xp-toast-container {
    position: fixed;
    bottom: 100px; /* 하단 메뉴 위에 표시 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.xp-toast {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.xp-toast.xp { border-color: rgba(255, 215, 0, 0.3); }
.xp-toast.bonus { border-color: rgba(255, 165, 0, 0.3); }

.toast-icon {
    font-size: 1.2rem;
}

.xp-toast.xp .toast-icon { color: #ffd700; }
.xp-toast.bonus .toast-icon { color: #ffffff; }
.xp-toast.info .toast-icon { color: #3498db; }

.toast-message {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

/* Vue Transition: toast-fade */
.toast-fade-enter-active,
.toast-fade-leave-active {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast-fade-enter-from,
.toast-fade-leave-to {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
}

/* ================================
   레벨 아이콘 반짝임 효과
   ================================ */

.level-icon-glow {
    display: inline-block;
    animation: iconGlow 2s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8),
                 0 0 20px rgba(255, 215, 0, 0.6),
                 0 0 30px rgba(255, 215, 0, 0.4);
}

@keyframes iconGlow {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 5px rgba(255, 215, 0, 0.6));
        transform: scale(1);
    }
    50% {
        filter: brightness(1.3) drop-shadow(0 0 15px rgba(255, 215, 0, 1));
        transform: scale(1.05);
    }
}
