/* step1~5 및 모달/오버레이용 x(닫기) 버튼 고정 위치 스타일 */
.close-btn, .modal-close-btn, .step-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 200;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
}

/* 부모 컨테이너가 relative여야 absolute가 정상 동작 */
.step-modal, .step-overlay, .modal-overlay, .result-card {
    position: relative;
}

@media (max-width: 400px) {
    .close-btn, .modal-close-btn, .step-close-btn {
        top: 4px;
        right: 4px;
        font-size: 1.2rem;
    }
}
/* 💜 망각 주기 도래 스테이지 버튼/모달 */
        #forgetting-btn {
            position: fixed;
            left: 50%;
            bottom: 80px;
            transform: translateX(-50%);
            z-index: 120;
            background: var(--primary-color);
            color: #2c3e50;
            font-size: 1.1rem;
            font-weight: bold;
            padding: 12px 32px;
            border-radius: 30px;
            border: none;
            box-shadow: 0 2px 10px #2224;
            cursor: pointer;
            transition: background 0.2s, color 0.2s;
            display: none;
        }
        #forgetting-btn:active {
            background: #ffe066;
            color: #222;
        }

        /* 1. 모달 전체 틀 (Flex 컨테이너로 변환하여 전체 스크롤을 막습니다) */
/* 오리지널 코드로 원상복구 */
#forgetting-modal .result-card {
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    background: #fffbe6;
    color: #2c3e50;
    border: 2px solid #f1c40f;
    box-shadow: 0 8px 32px rgba(44,62,80,0.18);
}

#forgetting-stage-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
        .forgetting-stage-item {
            background: #f9f6e7;
            border: 1px solid #f1c40f;
            border-radius: 12px;
            padding: 10px 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 1rem;
            box-shadow: 0 2px 8px rgba(241,196,15,0.07);
        }
        .forgetting-stage-item .play-btn {
            background: #f1c40f;
            color: #2c3e50;
            border: none;
            border-radius: 8px;
            padding: 6px 16px;
            font-weight: bold;
            cursor: pointer;
            font-size: 0.95rem;
            transition: background 0.2s, color 0.2s;
        }
        .forgetting-stage-item .play-btn:active {
            background: #ffe066;
            color: #222;
        }
        /* [1. 기본 설정] */
        :root {
            --primary-color: #f1c40f; 
            --bg-dark: #2c3e50;       
            --text-light: #ecf0f1;
            --home-accent-rgb: 241, 196, 15;
            --home-accent-strong-rgb: 52, 152, 219;
            --home-btn-a-rgb: 241, 196, 15;
            --home-btn-b-rgb: 52, 152, 219;
        }

        /* [수정] body, html 스타일 (스크롤 잠금 해제) */
body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    font-family: 'Noto Serif KR', serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* ★ 수정: 화면을 고정하기 위해 스크롤 비활성화 */
    overflow-y: hidden;  /* 위아래 스크롤 차단 */
    overflow-x: hidden;  /* 좌우 스크롤도 차단 */
    
    /* 각 화면 내에서만 스크롤 가능하도록 함 */
    position: fixed;     /* PC와 모바일 모두 화면 고정 */
    
    overscroll-behavior-y: contain;
}

        /* [2. 화면 컨테이너] */
        .screen {
            display: none;
            width: 100%; height: 100%;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            position: fixed;
            top: 0; left: 0;
            transition: opacity 0.5s ease;
        }
        .screen.active { display: flex; }
        .hidden { display: none !important; }

        /* [3. 홈 화면 스타일 & 성전 건축] */
        #home-screen {
                                    overflow-y: auto;
                        min-height: 100vh;
                        overflow-y: auto;
            background: radial-gradient(1600px circle at 20% 10%, rgba(var(--home-accent-strong-rgb), 0.45) 0%, #1b2438 55%, #0f141f 100%);
            text-align: center; padding: 20px;
            box-sizing: border-box;
            overflow: hidden;
            justify-content: flex-start;
            position: relative;
            isolation: isolate;
        }

        @media (max-height: 850px) {
            #home-screen {
                /* 스크롤 제거: overflow-y: auto 삭제 */
            }
        }
        #home-screen::before {
            content: "";
            position: absolute;
            inset: -30% -10% auto -10%;
            height: 70%;
            background: radial-gradient(closest-side at 30% 40%, rgba(var(--home-accent-rgb), 0.2), rgba(var(--home-accent-rgb), 0) 70%),
                        radial-gradient(closest-side at 75% 20%, rgba(var(--home-accent-strong-rgb), 0.35), rgba(var(--home-accent-strong-rgb), 0) 75%);
            filter: blur(10px);
            z-index: 0;
        }
        #home-screen::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(180deg, rgba(15, 20, 31, 0.15) 0%, rgba(15, 20, 31, 0.65) 60%, rgba(15, 20, 31, 0.85) 100%);
            z-index: 0;
        }
        #home-screen > * {
            position: relative;
            z-index: 1;
        }
        #home-screen > div:first-of-type {
            /* 박스 스타일 제거: 타이틀 배경, 테두리, 그림자, 패딩 등 삭제 */
        }
        #castle-display {
            margin-top: 6px;
        }
        .game-title { font-size: 3rem; font-weight: bold; color: var(--primary-color); text-shadow: 0 6px 18px rgba(0,0,0,0.6); letter-spacing: 1px; }
        @media (max-width: 600px) {
            .game-title {
                font-size: 2.1rem;
                word-break: keep-all;
            }
        }

        @media (max-width: 400px) {
            .game-title {
                font-size: 1.3rem;
                word-break: keep-all;
            }
        }
        .game-subtitle { font-size: 1rem; opacity: 0.95; margin-bottom: 0; font-style: italic; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
        
        /* 성전 건축 단계별 스타일 */
        .castle-area {
            width: 300px; height: 300px;
            background-color: rgba(255, 255, 255, 0.1);
            border-radius: 20px; margin-bottom: 50px;
            display: flex; align-items: center; justify-content: center;
            border: 2px dashed rgba(255, 255, 255, 0.3);
            position: relative;
            background-size: cover; background-position: center;
            text-shadow: 0 2px 4px rgba(0,0,0,0.8);
            transition: all 1s ease;
        }
        .castle-lv0 { border: 2px dashed rgba(255,255,255,0.3); }
        .castle-lv1 { background-image: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #a18cd1 100%); border: 2px solid #fff; }
        .castle-lv2 { background-image: linear-gradient(to top, #00c6fb 0%, #005bea 100%); }
        .castle-lv3 { background-image: radial-gradient(circle, #fdfbfb 0%, #ebedee 100%); color: #333; text-shadow: none; }
        .castle-lv4 { background-image: linear-gradient(to right, #f7971e, #ffd200); color: #2c3e50; }
        .castle-lv5 { background-image: url('https://www.transparenttextures.com/patterns/stardust.png'), linear-gradient(to bottom, #cfd9df 0%, #e2ebf0 100%); box-shadow: 0 0 50px gold; animation: shine 5s infinite alternate; }
        @keyframes shine { 0% { box-shadow: 0 0 20px gold; } 100% { box-shadow: 0 0 60px gold, 0 0 20px white; } }

        .btn-start {
            background: var(--primary-color); color: #2c3e50;
            font-size: 1.2rem; font-weight: bold; padding: 15px 40px;
            border: none; border-radius: 50px; cursor: pointer;
            box-shadow: 0 4px 15px rgba(241, 196, 15, 0.4);
        }

        /* 통일된 돌아가기 버튼 스타일 (랭킹/상점/미션/도감/기록실) */
        .btn-back {
            display: none; /* 기본적으로 숨김 처리: 특정 화면에서만 보이게 함 */
            position: fixed;
            bottom: calc(60px + 10px + env(safe-area-inset-bottom, 0px));
            left: 50%;
            transform: translateX(-50%);
            background: #95a5a6;
            color: white;
            border: none;
            padding: 10px 30px;
            border-radius: 30px;
            font-weight: bold;
            box-shadow: 0 4px 10px rgba(0,0,0,0.3);
            cursor: pointer;
            z-index: 60;
            transition: transform 0.08s ease, box-shadow 0.08s ease;
        }
        .btn-back:active { transform: translateX(-50%) translateY(3px); box-shadow: none; }

        /* 허용: 아래 화면들에서만 돌아가기 버튼을 표시 */
        #shop-screen .btn-back,
        #ranking-screen .btn-back,
        #mission-screen .btn-back,
        #life-book-screen .btn-back,
        #achievement-screen .btn-back {
            display: inline-block !important;
        }

        /* [4. 맵 화면 스타일 (약속의 땅 버전)] */
        #map-screen { 
            justify-content: flex-start; 
            background-color: #1a1a2e; /* 기본 배경 */
            padding: 0; /* 여백 제거 (땅으로 꽉 채우기 위해) */
        }

        /* 도감 화면: 전체 x축 스크롤 방지 */
        #life-book-screen {
            overflow-x: hidden;
        }
        #life-book-screen > div,
        #life-book-screen #card-grid {
                        padding-bottom: 100px;
            box-sizing: border-box;
            max-width: 100%;
        }
        
        /* 맵 컨테이너 */
        .river-map-container {
            flex: 1; width: 100%;
            position: relative;
            overflow-y: auto;
            overflow-x: hidden;
            /* 하단 네비게이션 가리지 않게 여백 */
            padding-bottom: 100px; /* 돌아가기 버튼 높이만큼 여백 추가 */
            background: #2c2c2c; /* 기본 황무지 색 */
        }

        /* [수정] 껍데기 (위치 잡는 역할만 함, 레이어 간섭 X) */
        .zone-wrapper {
            width: 100%;
            height: 120px;
            position: relative; /* 자식들의 기준점 */
            display: flex;
            align-items: center;
            justify-content: center;
            box-sizing: border-box;
            /* 중요: 여기에 z-index나 transform을 주면 안 됨 */
        }

        /* [NEW] 진짜 땅 배경 (1층 - 맨 밑) */
        .land-bg {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            z-index: 1; /* 강물(5)보다 낮아야 함 */
            transition: all 1s ease;
            border-bottom: 1px dashed rgba(255,255,255,0.05);
        }

        /* 황무지 상태 */
        .land-bg.barren {
            background-color: #3e2723;
            background-image: 
                radial-gradient(circle at 20% 20%, rgba(0,0,0,0.4) 0%, transparent 20%),
                radial-gradient(circle at 80% 80%, rgba(0,0,0,0.4) 0%, transparent 20%);
            filter: grayscale(80%);
        }

        /* 꽃밭 상태 */
        .land-bg.garden {
            background-color: #27ae60;
            background-image: 
                radial-gradient(circle at 10% 10%, #2ecc71 0%, transparent 10%),
                radial-gradient(circle at 90% 90%, #2ecc71 0%, transparent 10%);
            filter: none;
            box-shadow: inset 0 0 20px rgba(255,255,255,0.2);
        }

        /* 꽃 장식 */
        .land-bg.garden::before {
            content: '🌸 🌼 🌿 🌷'; 
            position: absolute;
            width: 100%; height: 100%;
            display: flex; justify-content: space-around; align-items: center;
            font-size: 1.2rem;
            opacity: 0.6;
            animation: sway 3s infinite ease-in-out;
        }

        /* 강물 (2층 - 땅 위, 나무 아래) */
        #river-svg {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            z-index: 5; /* 땅(1)보다 높고, 나무(10)보다 낮음 */
            pointer-events: none;
        }

/* [누락된 강물 스타일 복구] */
        .river-path {
            fill: none; /* 검은색 채우기 없애기 */
            stroke: #3498db; /* 파란색 선 */
            stroke-width: 30px; /* 강폭 */
            stroke-linecap: round;
            stroke-linejoin: round;
            filter: drop-shadow(0 0 15px #3498db); /* 네온 효과 */
            opacity: 0.7;
            transition: d 0.3s ease;
        }

        /* 스테이지 버튼 (3층 - 맨 위) */
        .stage-node {
            width: 60px; height: 60px;
            z-index: 10; /* 강물(5)보다 확실히 위! */
            position: relative;
            cursor: pointer;
            transition: transform 0.2s;
        }

        /* 지그재그 배치 (Wrapper에 적용) */
        .zone-wrapper.left { justify-content: flex-start; padding-left: 20%; }
        .zone-wrapper.right { justify-content: flex-end; padding-right: 20%; }


/* [수정] 완료된 나무 (황금 테두리 + 초록 배경) */
        .stage-node.completed .tree-icon {
            background-color: #27ae60; /* 싱그러운 초록색 */
            border-color: #f1c40f;     /* 황금 테두리 */
            box-shadow: 0 0 20px rgba(241, 196, 15, 0.6); /* 성령의 빛 */
            position: relative; /* 열매 배치를 위해 */
            overflow: visible;  /* 열매가 밖으로 튀어나와도 보이게 */
        }

        /* [NEW] 열매 (Fruit) 오버레이 */
        .fruit-cluster {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            pointer-events: none;
            z-index: 15;
        }

        /* 개별 열매 스타일 */
        .fruit {
            position: absolute;
            font-size: 0.8rem; /* 열매 크기 */
            filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
            animation: fruit-bounce 3s infinite ease-in-out;
        }

        /* 열매 위치 배치 (삼각형 구도) */
        .f1 { top: 5%; left: 50%; transform: translateX(-50%); animation-delay: 0s; }   /* 꼭대기 */
        .f2 { top: 35%; left: 15%; animation-delay: 0.5s; } /* 왼쪽 */
        .f3 { top: 35%; right: 15%; animation-delay: 1.0s; } /* 오른쪽 */
        .f4 { bottom: 20%; left: 35%; font-size: 0.6rem; animation-delay: 1.5s; } /* 중앙 아래 (작은거) */

        /* 열매가 살랑거리는 애니메이션 */
        @keyframes fruit-bounce {
            0%, 100% { transform: translateY(0) scale(1); }
            50% { transform: translateY(-3px) scale(1.1); }
        }
        
        /* 꼭대기 열매는 좌우 정렬 유지하며 움직임 */
        @keyframes fruit-bounce-top {
            0%, 100% { transform: translateX(-50%) translateY(0); }
            50% { transform: translateX(-50%) translateY(-3px); }
        }
        .f1 { animation-name: fruit-bounce-top; }

        /* 나무 아이콘 */
        .tree-icon {
            width: 100%; height: 100%;
            background-color: #2c3e50;
            border-radius: 50%;
            border: 3px solid #95a5a6;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.8rem;
            box-shadow: 0 5px 10px rgba(0,0,0,0.5);
        }
        
        .stage-node.completed .tree-icon {
            background-color: #f1c40f; /* 황금 나무 */
            border-color: #fff;
            box-shadow: 0 0 20px #f1c40f;
        }
        .stage-node.locked .tree-icon { opacity: 0.5; background: #333; }

        /* 라벨 */
        .stage-label {
            position: absolute;
            bottom: -25px; left: 50%;
            transform: translateX(-50%);
            background: rgba(0,0,0,0.7);
            color: #fff;
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.8rem;
            white-space: nowrap;
        }

        /* 하단 네비게이션 */
        .bottom-nav {
            width: 100%; height: 60px; background-color: #2c3e50;
            display: none; border-top: 1px solid rgba(255,255,255,0.1);
            position: fixed; bottom: 0; z-index: 50;
        }
        #map-screen.active ~ .bottom-nav {
            display: flex !important;
        }
        .nav-item { flex: 1; display: flex; align-items: center; justify-content: center; color: #95a5a6; font-size: 0.8rem; flex-direction: column; cursor: pointer; }
        .nav-item:active { color: var(--primary-color); }

        /* [5. 스테이지 시트 (Bottom Sheet)] */
        #stage-sheet {
            position: absolute; bottom: 0; left: 0; width: 100%; height: 70%;
            background-color: #ecf0f1; border-radius: 30px 30px 0 0;
            box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
            transform: translateY(110%); transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
            z-index: 100; display: flex; flex-direction: column;
        }
        #stage-sheet.open { transform: translateY(0); }
        .sheet-header { padding: 20px; text-align: center; border-bottom: 1px solid #bdc3c7; background: white; border-radius: 30px 30px 0 0; position: relative; }
        .sheet-title { font-size: 1.5rem; font-weight: bold; color: #2c3e50; margin: 0; }
        .close-btn { display: none !important; }
        /* 스테이지 목록 닫기 버튼은 표시 + 우측 배치 */
        #stage-sheet .close-btn {
            display: block !important;
            position: absolute;
            top: 15px;
            right: 20px;
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: #7f8c8d;
        }
        .stage-list { flex: 1; overflow-y: auto; padding: 20px; }
        .stage-item {
            background: white; margin-bottom: 15px; padding: 15px; border-radius: 15px;
            display: flex; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); cursor: pointer;
        }
        .stage-icon { width: 40px; height: 40px; border-radius: 50%; background: #bdc3c7; display: flex; align-items: center; justify-content: center; margin-right: 15px; font-weight: bold; }
        .stage-info { flex: 1; color: #2c3e50; }
        .step-hint-badge {
            display: inline-block;
            margin-top: 6px;
            padding: 3px 8px;
            border-radius: 10px;
            font-size: 0.75rem;
            font-weight: bold;
            color: #2c3e50;
            background: #f7f1c4;
            border: 1px solid #f1c40f;
        }
        .stage-item.boss { background: #fff0f0; border: 2px solid #e74c3c; }
        .stage-item.boss .stage-icon { background: #e74c3c; color: white; }

/* [보스 피격 효과 - 수정됨] */
@keyframes boss-hit-shake {
    0% { transform: translate(0, 0) rotate(0deg) scaleX(-1); filter: none; }
    10% { transform: translate(-10px, 0) rotate(-10deg) scaleX(-1); filter: grayscale(100%) brightness(40%) sepia(100%) hue-rotate(-50deg) saturate(600%) contrast(0.8); } /* 강렬한 빨강 */
    30% { transform: translate(10px, 0) rotate(10deg) scaleX(-1); filter: grayscale(100%) brightness(40%) sepia(100%) hue-rotate(-50deg) saturate(600%) contrast(0.8); }
    50% { transform: translate(-10px, 0) rotate(-10deg) scaleX(-1); filter: grayscale(100%) brightness(40%) sepia(100%) hue-rotate(-50deg) saturate(600%) contrast(0.8); }
    70% { transform: translate(10px, 0) rotate(10deg) scaleX(-1); filter: none; }
    100% { transform: translate(0, 0) rotate(0deg) scaleX(-1); filter: none; }
}

/* 중요: !important를 붙여서 기존 둥둥 뜨는 애니메이션을 무시하게 함 */
.boss-hit-effect {
    animation: boss-hit-shake 0.5s ease-out !important; 
}

/* [데미지 텍스트 효과] */
.floating-damage {
    position: absolute;
    color: #ff4757;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 0 #fff;
    pointer-events: none; /* 클릭 방해 안 함 */
    animation: floatUp 1s forwards;
    z-index: 100;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-30px) scale(1.5); opacity: 1; }
    100% { transform: translateY(-60px) scale(1); opacity: 0; }
}

/* [알림 배지 (Red Dot) 스타일] */
.nav-item {
    position: relative; /* 배지 위치 기준점 */
}

.nav-badge {
    position: absolute;
    top: 5px;
    right: 30%; /* 아이콘 오른쪽 위에 배치 */
    width: 10px;
    height: 10px;
    background-color: #e74c3c; /* 빨간색 */
    border: 2px solid #2c3e50; /* 배경색과 같은 테두리로 분리감 주기 */
    border-radius: 50%;
    display: none; /* 평소엔 숨김 */
    z-index: 60;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.8);
    animation: bounce-badge 1s infinite;
}

.nav-badge.active {
    display: block; /* 활성화되면 보임 */
}

@keyframes bounce-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* [추가] 스테이지 보상 미리보기 태그 */
.reward-preview {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}
.reward-tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 3px;
}
/* [수정] 기존 .tag-xp를 .tag-score로 변경하고 금색 테마 적용 */
.tag-score { 
    background-color: #fff3cd; /* 아주 연한 금색 배경 */
    color: #856404;            /* 진하고 가독성 좋은 황토색 글자 */
    border: 1px solid #ffeeba; /* 은은한 금색 테두리 */
}
.tag-gem { background-color: #fff3e0; color: #e67e22; border: 1px solid #ffe0b2; } /* 주황색 (보석) */

        /* [6. 게임 화면 (보스전)] */
        #game-screen {
            background-color: #2c3e50;
            background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://www.transparenttextures.com/patterns/cubes.png');
            justify-content: space-between;
        }
        .battle-header { 
            width: 100%; 
            padding: 20px; 
            background: linear-gradient(to bottom, #721c24, #2c3e50); 
            display: flex; 
            flex-direction: row; 
            align-items: flex-start; 
            box-shadow: 0 5px 15px rgba(0,0,0,0.5); 
            z-index: 10; 
            box-sizing: border-box;
            gap: 30px;
        }
        
        .boss-status {
            display: flex;
            flex-direction: column;
            align-items: center;
            flex: 0 0 auto;
            min-width: 140px;
        }
        
        .boss-avatar { 
            font-size: 7rem; 
            animation: floating 3s ease-in-out infinite, breathing-fire 4s ease-in-out infinite;
            margin-bottom: 10px;
            filter: drop-shadow(0 0 8px #ff6b3d);
            position: relative;
            transform: scaleX(-1);
        }
        
        /* 용이 불을 뿜는 애니메이션 */
        .boss-avatar::before {
            content: '🔥';
            position: absolute;
            font-size: 3.5rem;
            left: -2rem;
            top: 0.5rem;
            opacity: 0;
            animation: fire-burst 2s ease-in-out infinite;
        }
        
        @keyframes breathing-fire {
            0%, 100% { transform: scaleX(-1); filter: drop-shadow(0 0 8px #ff6b3d); }
            50% { transform: scaleX(-1.1); filter: drop-shadow(0 0 15px #ff4500); }
        }
        
        @keyframes fire-burst {
            0% { opacity: 0; transform: translateX(0) scale(0.5); }
            30% { opacity: 1; transform: translateX(-15px) scale(1); }
            70% { opacity: 0.8; transform: translateX(-30px) scale(0.8); }
            100% { opacity: 0; transform: translateX(-40px) scale(0.3); }
        }
        
        .hp-container { 
            width: 100%; 
            height: 24px; 
            background-color: #2c3e50; 
            border-radius: 12px; 
            overflow: hidden;
            border: 2px solid #8b0000; 
            margin-bottom: 8px;
            display: flex;
            gap: 1px;
            padding: 2px;
            box-sizing: border-box;
        }
        
        .hp-bar-fill { 
            height: 100%; 
            background: linear-gradient(90deg, #e74c3c 0%, #c0392b 50%, #a93226 100%);
            transition: width 0.3s ease; 
            border-radius: 8px;
        }
        
        .hp-segment {
            flex: 1;
            height: 100%;
            background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
            border-radius: 6px;
            border: 1px solid #7b241c;
            box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
        }
        
        .hp-segment.damaged {
            background: linear-gradient(90deg, #5d4037 0%, #3e2723 100%);
            opacity: 0.5;
        }
        
        .boss-hp-text { 
            font-size: 0.95rem; 
            color: #ff9999;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0,0,0,0.7);
        }
        .player-status { 
            width: 100%; 
            display: flex; 
            flex-direction: column;
            justify-content: flex-start;
            gap: 12px;
            font-size: 1rem; 
            flex: 1;
        }
        
        .player-status > div {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
        }
        
        .heart-display {
            background: rgba(255,69,0,0.2);
            padding: 8px 15px;
            border-radius: 15px;
            border: 1px solid #ff6b3d;
            font-weight: bold;
        }
        .battle-field { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
        .verse-indicator { color: var(--primary-color); margin-bottom: 15px; font-weight: bold; }
        .answer-zone { width: 90%; min-height: 100px; max-height: 35vh; background-color: rgba(255,255,255,0.1); border: 2px dashed rgba(255,255,255,0.3); border-radius: 10px; padding: 15px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; justify-content: center; overflow-y: auto; }
        .placeholder-text { color: rgba(255,255,255,0.3); margin-top: 30px; }
        .battle-control { width: 100%; background-color: #34495e; padding: 20px; border-top: 1px solid #7f8c8d; display: flex; flex-direction: column; gap: 15px; box-sizing: border-box; }
        .block-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 80px; }
        .word-block { background-color: #ecf0f1; color: #2c3e50; padding: 10px 15px; border-radius: 20px; font-weight: bold; cursor: pointer; box-shadow: 0 3px 0 #bdc3c7; transition: transform 0.1s; }
        .word-block:active { transform: translateY(3px); box-shadow: none; }
        .answer-zone .word-block { background-color: var(--primary-color); box-shadow: 0 3px 0 #d35400; }
        .btn-attack { width: 100%; padding: 15px; background-color: #e74c3c; color: white; font-size: 1.2rem; font-weight: bold; border: none; border-radius: 10px; cursor: pointer; box-shadow: 0 4px 0 #c0392b; transition: background 0.15s; }
        .btn-attack:active { transform: translateY(4px); box-shadow: none; }

        /* Step5 다시하기 버튼 */
        .btn-reset-step5 {
            width: 100%;
            padding: 15px;
            background-color: #bdc3c7;
            color: #2c3e50;
            font-size: 1.1rem;
            font-weight: bold;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            box-shadow: 0 4px 0 #7f8c8d;
            margin-left: 0;
            transition: background 0.15s;
        }
        .btn-reset-step5:active {
            background-color: #95a5a6;
            color: #fff;
            box-shadow: none;
        }
        .btn-pause { background: none; border: 1px solid #7f8c8d; color: #bdc3c7; padding: 5px 10px; border-radius: 5px; cursor: pointer; }
        
        @keyframes floating { 0% { transform: translateY(0px) scaleX(-1); } 50% { transform: translateY(-10px) scaleX(-1); } 100% { transform: translateY(0px) scaleX(-1); } }
        @keyframes shake { 0% { transform: translate(1px, 1px) rotate(0deg); } 50% { transform: translate(-1px, 2px) rotate(-1deg); } 100% { transform: translate(1px, -2px) rotate(-1deg); } }
        .shake-effect { animation: shake 0.5s; }

/* [훈련 모드(Normal) 전용 스타일] */
#game-screen.mode-training {
    background-image: none;
    background-color: #ecf0f1; /* 밝은 배경 */
    color: #2c3e50; /* 어두운 글자 */
}

/* 훈련 모드일 때 보스 헤더 숨기기 */
#game-screen.mode-training .battle-header {
    display: none;
}

/* 훈련 모드 전용 헤더 */
.training-header {
    display: none; /* 기본 숨김 */
    width: 100%; padding: 20px;
    background-color: white;
    border-bottom: 1px solid #bdc3c7;
    justify-content: space-between; align-items: center;
    box-sizing: border-box;
}
#game-screen.mode-training .training-header { display: flex; } /* 훈련 모드일 때만 보임 */

/* 단계 표시기 (Step 1/5) */
.step-indicator {
    font-size: 1.2rem; font-weight: bold; color: var(--primary-color);
}
.step-progress-bar {
    flex: 1; height: 10px; background: #eee; margin: 0 15px; border-radius: 5px; overflow: hidden;
}
.step-progress-fill {
    height: 100%; background: var(--primary-color); width: 20%; transition: width 0.3s;
}

/* 텍스트 읽기 모드 (Step 1) 스타일 */
.reading-card {
    background: white; padding: 30px; border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    font-size: 1.5rem; line-height: 1.8; text-align: center;
    margin-bottom: 20px; width: 90%;
}

/* [결과 화면 스타일] */
.modal-overlay {
    display: none; /* 평소엔 숨김 */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 200;
    align-items: center; justify-content: center;
    animation: fadeIn 0.3s;
}
.modal-overlay.active { display: flex; }

.result-card {
    background: white; width: 85%; max-width: 350px;
    border-radius: 20px; padding: 30px 20px;
    text-align: center; color: #2c3e50;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(0.9); animation: popUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.result-header { font-size: 2rem; font-weight: 900; color: #f1c40f; margin-bottom: 20px; text-shadow: 1px 1px 0 #d35400; }

.streak-container { background: #fff5e6; padding: 10px; border-radius: 15px; margin-bottom: 20px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.streak-icon { font-size: 1.5rem; animation: pulse 1s infinite; }
.streak-text { font-weight: bold; color: #e67e22; }

.stats-grid { display: flex; justify-content: space-around; margin-bottom: 25px; }
.stat-box { display: flex; flex-direction: column; gap: 5px; }
.stat-label { font-size: 0.8rem; color: #7f8c8d; }
.stat-value { font-size: 1.2rem; font-weight: bold; color: #2c3e50; }

.btn-continue {
    background: var(--primary-color); color: #2c3e50; border: none;
    width: 100%; padding: 15px; border-radius: 50px;
    font-size: 1.2rem; font-weight: bold; cursor: pointer;
    box-shadow: 0 4px 0 #d35400;
}
.btn-continue:active { transform: translateY(4px); box-shadow: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popUp { to { transform: scale(1); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* [Step 5 전용 스타일: 정답/오답 피드백] */
.word-block.error-block {
    background-color: #e74c3c !important; /* 빨간색 */
    color: white;
    animation: shake 0.4s;
    border: 2px solid #c0392b;
}

.word-block.correct-block {
    background-color: #2ecc71 !important; /* 초록색 */
    color: white;
    border: 2px solid #27ae60;
}

/* [선택된 블록 강조 스타일] */
.word-block.selected-block {
    border: 3px solid #f1c40f !important; /* 진한 노란색 */
    background-color: #fff9c4 !important; /* 연한 노란색 배경 */
    color: #333 !important;
    transform: scale(1.1); /* 약간 커짐 */
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    z-index: 10;
}

/* [아이템 버튼 스타일] */
.item-btn { 
    background: rgba(0,0,0,0.5); 
    border: 1px solid #7f8c8d; 
    color: white; 
    border-radius: 5px; 
    cursor: pointer; 
    font-size: 0.9rem; 
    padding: 4px 8px; 
    display: flex; 
    align-items: center; 
    gap: 5px;
}
.item-btn:active { transform: scale(0.95); }
/* 훈련 모드에서는 글자색이 어두우니 배경을 다르게 */
.training-header .item-btn {
    background: #fff;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
}

/* [모바일 화면 잘림 해결 패치] */

/* 1. 전체 화면 높이를 정확히 잡고 스크롤 방지 */
#game-screen {
    height: 100vh; /* 화면 전체 높이 */
    height: 100dvh; /* 모바일 브라우저 주소창 고려 (지원하는 경우) */
    flex-direction: column;
    overflow: hidden; /* 전체 스크롤 막음 */
}

/* 2. 헤더는 고정 (크기 유지) */
.training-header, .battle-header {
    flex-shrink: 0; /* 찌그러짐 방지 */
}

/* 3. 가운데 문제 영역 (여기가 넘치면 스크롤 생기게 변경) */
.battle-field {
    flex: 1; /* 남은 공간 차지 */
    overflow-y: auto; /* 내용이 길면 여기만 스크롤! */
    min-height: 0; /* Flexbox 버그 방지용 */
    justify-content: flex-start; /* 내용이 적어도 위에서부터 시작 */
    padding-bottom: 20px;
}

/* 4. 하단 컨트롤 영역 (항상 보이게 고정) */
.battle-control {
    flex-shrink: 0; /* 절대 줄어들지 않음 */
    background-color: #34495e;
    z-index: 10;
    
    /* 모바일 하단바(홈버튼 등)에 가려지지 않게 여유 공간 추가 */
    padding-bottom: max(20px, env(safe-area-inset-bottom)); 
}

/* 5. 블록들이 너무 크면 모바일에서 줄바꿈이 심하므로 살짝 축소 */
@media (max-width: 600px) {
    .word-block {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    .verse-indicator {
        font-size: 0.9rem;
        margin-top: 10px;
    }
    /* 훈련 모드 Step 1~5 표시 영역 축소 */
    .reading-card {
        padding: 15px;
        font-size: 1.2rem;
    }
}


/* [미션 아이템 스타일] */
.mission-item {
    background: white;
    padding: 15px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.mission-info { flex: 1; margin-right: 10px; }
.mission-title { font-weight: bold; color: #2c3e50; font-size: 1rem; }
.mission-desc { font-size: 0.8rem; color: #7f8c8d; margin-bottom: 5px; }
.mission-progress-bg { width: 100%; height: 6px; background: #eee; border-radius: 3px; overflow: hidden; }
.mission-progress-bar { height: 100%; background: #3498db; transition: width 0.3s; }

.btn-claim {
    background: #bdc3c7; color: white; border: none;
    padding: 8px 15px; border-radius: 20px; font-weight: bold; font-size: 0.8rem;
    cursor: default;
}
.btn-claim.ready {
    background: linear-gradient(to bottom, #f1c40f, #f39c12);
    color: #2c3e50; cursor: pointer;
    box-shadow: 0 2px 0 #d35400; animation: pulse 1s infinite;
}
.btn-claim.done {
    background: #2ecc71; color: white; cursor: default;
    box-shadow: none; animation: none;
}

/* [미션 탭 스타일] */
.tab-btn {
    background: transparent;
    border: 2px solid #7f8c8d;
    color: #95a5a6;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn.active {
    background: var(--primary-color);
    color: #2c3e50;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

/* [생명책 카드 스타일] */
.card-item {
    background: #ecf0f1;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3/4; /* 카드 비율 */
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.card-item:active { transform: scale(0.95); }

/* 등급별 스타일 */
.tier-bronze { border: 3px solid #cd7f32; background: linear-gradient(135deg, #fff, #e0c3a5); }
.tier-silver { border: 3px solid #bdc3c7; background: linear-gradient(135deg, #fff, #bdc3c7); box-shadow: 0 0 10px rgba(189, 195, 199, 0.5); }
.tier-gold   { border: 3px solid #f1c40f; background: linear-gradient(135deg, #fff, #f9e79f); box-shadow: 0 0 15px rgba(241, 196, 15, 0.6); }
.tier-diamond { border: 3px solid #3498db; background: linear-gradient(135deg, #e0f7fa, #81d4fa); box-shadow: 0 0 20px rgba(52, 152, 219, 0.8); animation: pulse 2s infinite; }

.card-num { font-size: 1.2rem; font-weight: bold; color: #2c3e50; margin-bottom: 5px; }
.card-tier-label { font-size: 0.7rem; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,0.5); color: white; }

/* [수정] 생명책 챕터 버튼 컨테이너 (스크롤 영역) */
#lb-chapter-selector {
    display: flex;
    gap: 10px;
    
    /* ★ 핵심 수정: 화면 밖으로 나가지 못하게 가로폭 제한 */
    width: 100%;           
    max-width: 100vw;      
    box-sizing: border-box; /* 패딩 포함해서 크기 계산 */
    
    overflow-x: auto;      /* 내용이 넘치면 스크롤 */
    padding: 15px 5px;     /* 터치하기 편하게 패딩 확보 */
    white-space: nowrap;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 10px;
    
    /* 모바일 터치감 설정 */
    -webkit-overflow-scrolling: touch; 
    overscroll-behavior-x: contain;    
    scroll-snap-type: x proximity;     
    
    /* 파이어폭스용 스크롤바 (진한 노랑) */
    scrollbar-width: thin; 
    scrollbar-color: #f1c40f #2c3e50; 
}

/* [수정] PC용 스크롤바 디자인 (크롬, 엣지, 사파리) - 고대비(High Contrast) 버전 */
#lb-chapter-selector::-webkit-scrollbar {
    height: 12px; /* 더 두껍게 키움! */
    background-color: #1a252f; /* 트랙 배경을 아주 어둡게 */
}

#lb-chapter-selector::-webkit-scrollbar-track {
    background-color: #1a252f; 
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1); /* 트랙 테두리 */
}

#lb-chapter-selector::-webkit-scrollbar-thumb {
    background-color: #f1c40f; /* ★ 아주 선명한 노란색 */
    border-radius: 6px;
    border: 2px solid #1a252f; /* 스크롤바 주위에 여백 느낌 주기 */
    min-width: 50px; /* 손잡이가 너무 작아지지 않게 */
}

/* 마우스 올렸을 때 더 밝게 빛남 */
#lb-chapter-selector::-webkit-scrollbar-thumb:hover {
    background-color: #f39c12; 
    box-shadow: inset 0 0 5px rgba(255,255,255,0.5);
}

/* [생명책 챕터 버튼 스타일] */
.lb-chapter-btn {
    background: rgba(0,0,0,0.3);
    color: #95a5a6;
    border: 1px solid #7f8c8d;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0; 
    transition: all 0.2s;
    scroll-snap-align: center; /* 스크롤 멈출 때 가운데 정렬 */
}
.lb-chapter-btn.active {
    background: var(--primary-color);
    color: #2c3e50;
    border-color: var(--primary-color);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    transform: scale(1.05);
}

/* [건설 연출 애니메이션] */
@keyframes hammer {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-30deg); }
    50% { transform: rotate(0deg); } /* 타격! */
    100% { transform: rotate(0deg); }
}

/* 쿵! 하고 먼지 나는 효과 (화면 흔들림) */
.shake-screen {
    animation: shake-hard 0.3s;
}
@keyframes shake-hard {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5px, 5px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(-5px, 5px); }
    100% { transform: translate(0, 0); }
}

/* [힌트 시스템 효과] */
@keyframes hint-blink {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(241, 196, 15, 0); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px #f1c40f; background-color: #fff9c4; border-color: #f1c40f; }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(241, 196, 15, 0); }
}

.hint-highlight {
    animation: hint-blink 1s infinite; /* 계속 반짝임 */
    z-index: 50;
    position: relative;
}

/* 옥에 티 범인 지목 스타일 */
.imposter-reveal {
    background-color: #e74c3c !important;
    color: white !important;
    font-weight: bold;
    box-shadow: 0 0 15px #c0392b;
    transform: scale(1.1);
}

/* [힌트: 오답 지적 효과 (빨강 깜빡임)] */
@keyframes hint-error-blink {
    0% { transform: scale(1); background-color: #ecf0f1; }
    50% { transform: scale(1.1); background-color: #e74c3c; color: white; border-color: #c0392b; box-shadow: 0 0 15px #e74c3c; }
    100% { transform: scale(1); background-color: #ecf0f1; }
}

.hint-error {
    animation: hint-error-blink 1s infinite;
    z-index: 60; /* 노란 힌트보다 더 위 */
}

/* 1. 탭 전체 컨테이너 (Flexbox 적용) */
/* 내용이 적으면 버튼을 바닥으로 밀고, 많으면 스크롤을 만듭니다 */
.tab-content {
    min-height: 100vh;      /* 화면 전체 높이 사용 */
    display: flex;          /* 플렉스 박스 모드 */
    flex-direction: column; /* 세로 정렬 */
    box-sizing: border-box;
    background-color: #2c3e50; /* (예시) 배경색 (var(--bg-dark) 대신 사용) */
    color: white;
}

/* 2. 내용 영역 */
.content-body {
    flex-grow: 1; /* 남은 공간을 이 녀석이 다 차지해서 버튼을 밀어냄 */
    padding: 20px;
}

/* 3. 버튼 영역 수정 */
.button-area-static {
    padding: 8px 10px 8px 10px;
    
    /* [수정 1] 반투명(rgba) 대신 배경색과 똑같은 색(#2c3e50)을 칠합니다 */
    background: var(--bg-dark); /* 또는 #2c3e50 */
    
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    
    /* [수정 2] 모바일(아이폰 등)에서 홈 바 영역까지 색을 꽉 채우기 위해 여백 추가 */
    padding-bottom: max(65px, env(safe-area-inset-bottom));
}

/* 4. 회색 버튼 (보여주신 코드의 button 스타일을 수정해서 적용) */
.btn-gray {
    background: #95a5a6; /* 빨강(#e74c3c) -> 회색 변경! */
    color: white;
    border: none;
    padding: 12px 60px;
    border-radius: 30px; /* 동글동글한 알약 모양 유지 */
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}

/* 눌렀을 때 쫀득한 느낌 */
.btn-gray:active {
    transform: scale(0.95);
}

/* btn-back uses fixed centering; keep translateX when active to avoid right shift */
.btn-back.btn-gray:active {
    transform: translateX(-50%) translateY(3px) scale(0.95);
}

/* [3단계: 바이블 타워 게임 스타일] */
        #tower-game-container {
            width: 100%; height: 100%;
            position: relative;
            background: rgba(0,0,0,0.2); /* 배경 살짝 어둡게 */
            border-radius: 15px;
            overflow: hidden;
            border: 2px solid rgba(255,255,255,0.1);
            display: flex;
            flex-direction: column;
            align-items: center;
            touch-action: none; /* 터치 시 스크롤 방지 */
        }

        /* 움직이는 크레인 블록 (위쪽) */
        #moving-block {
            position: absolute;
            top: 60px;
            height: 40px;
            background: #e74c3c;
            color: white;
            display: flex; align-items: center; justify-content: center;
            border-radius: 5px;
            font-weight: bold;
            box-shadow: 0 4px 10px rgba(0,0,0,0.3);
            white-space: nowrap;
            padding: 0 15px;
            z-index: 10;
            border: 2px solid white;
        }

        /* 이미 쌓인 블록들 (아래쪽) */
        .stacked-block {
            position: absolute;
            height: 40px;
            background: #f1c40f; /* 황금 벽돌 */
            color: #2c3e50;
            border: 1px solid #d35400;
            display: flex; align-items: center; justify-content: center;
            border-radius: 4px;
            font-weight: bold;
            box-sizing: border-box;
            box-shadow: inset 0 0 10px rgba(255,255,255,0.3);
        }

        /* [수정] 쌓인 블록 영역 (움직임 효과 추가) */
        #tower-stack-area {
            position: absolute;
            width: 100%; height: 100%;
            bottom: 0; left: 0;
            transition: transform 0.5s ease; /* 스크롤 애니메이션 */
        }

        /* 바닥 (기초석) */
        #tower-base {
            position: absolute;
            bottom: 0; left: 50%;
            transform: translateX(-50%);
            width: 150px; height: 20px;
            background: #7f8c8d;
            border-radius: 5px 5px 0 0;
            border: 1px solid #95a5a6;
            transition: bottom 0.5s ease, transform 0.5s ease;
        }

        /* 게임 메시지 */
        #tower-msg {
            position: absolute;
            top: 20px; width: 100%;
            text-align: center;
            color: #2c3e50;
            font-weight: bold;
            font-size: 1rem;
            text-shadow: 0 0 5px white;
            z-index: 5;
        }

/* [건축 버튼 전용 스타일: 3D 효과 및 애니메이션] */
.btn-build-action {
    background: linear-gradient(to bottom, #f1c40f, #f39c12); /* 황금빛 그라데이션 */
    color: #fff;
    border: none;
    border-bottom: 5px solid #d35400; /* 버튼 입체감(그림자) */
    border-radius: 15px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

/* 눌렀을 때 효과 */
.btn-build-action:active {
    transform: translateY(3px); /* 아래로 눌리는 느낌 */
    border-bottom: 2px solid #d35400; /* 그림자가 줄어듦 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* 반짝이는 애니메이션 */
.btn-pulse {
    animation: glowing 1.5s infinite alternate;
}

@keyframes glowing {
    from { box-shadow: 0 0 5px #f1c40f, 0 0 10px #f1c40f; }
    to { box-shadow: 0 0 20px #f1c40f, 0 0 30px #f39c12; }
}

/* 수거 버튼 스타일 (파란색) */
.btn-claim-action {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    border-bottom: 5px solid #1c5980;
    color: white;
    border-radius: 15px;
    padding: 10px 20px;
    font-weight: bold;
    border: none;
    cursor: pointer;
}
.btn-claim-action:active {
    transform: translateY(3px);
    border-bottom: 2px solid #1c5980;
}

/* [추가] 토스트 알림창 스타일 (잠깐 떴다 사라짐) */
#toast-notification {
    visibility: hidden;
    min-width: 250px;
    background-color: rgba(44, 62, 80, 0.9); /* 짙은 남색 배경 */
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 1px solid #f1c40f; /* 노란색 테두리 포인트 */
    opacity: 0;
    transition: opacity 0.5s, bottom 0.5s;
}

#toast-notification.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px; /* 살짝 위로 떠오르는 효과 */
}

/* [Step 4: 예언의 두루마리 전용 스타일] */
#scroll-game-container {
    width: 100%; height: 200px;
    position: relative;
    overflow: hidden;
    background: #f5e6d3 url('https://www.transparenttextures.com/patterns/old-paper.png');
    border-top: 5px solid #8e44ad;
    border-bottom: 5px solid #8e44ad;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.3);
    display: flex; align-items: center;
    margin-bottom: 20px;
    border-radius: 10px;
}

#scroll-track {
    position: absolute;
    left: 100%; /* 오른쪽 끝에서 시작 */
    display: flex; gap: 20px;
    align-items: center;
    white-space: nowrap;
}

/* 데드라인 (불타는 선) */
#deadline-line {
    position: absolute; left: 60px; top: 0; bottom: 0;
    width: 4px; background: rgba(231, 76, 60, 0.5);
    z-index: 10;
    box-shadow: 0 0 10px #e74c3c;
    display: flex; align-items: center; justify-content: center;
}
#deadline-line::after { content: "🔥"; font-size: 1.5rem; text-shadow: 0 0 5px #e74c3c; }

/* 두루마리 단어들 */
.scroll-node {
    padding: 10px 15px; border-radius: 8px;
    background: rgba(255,255,255,0.8);
    color: #2c3e50; font-weight: bold; font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* [수정] 두루마리 빈칸 (초성 힌트가 보이도록 변경) */
.scroll-blank {
    background: #2c3e50; 
    color: #bdc3c7; /* ★ 투명(transparent)에서 회색으로 변경! */
    font-size: 0.9rem; /* 힌트니까 글씨를 약간 작게 */
    border: 2px dashed #e74c3c; 
    min-width: 60px;
    animation: pulse-border 1s infinite;
    
    /* 텍스트 가운데 정렬 */
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse-border { 0% { border-color:#e74c3c; } 50% { border-color:transparent; } 100% { border-color:#e74c3c; } }

.scroll-blank.filled {
    background: #f1c40f; color: #2c3e50;
    border: 2px solid #f39c12;
    animation: pop 0.3s;
    font-weight: bold;
}

/* 데드라인을 넘겨서 실패한 빈칸 (빨갛게 표시) */
.scroll-blank.failed {
    background: #e74c3c; color: white;
    border: none;
    animation: none;
    font-size: 0.9rem;
}

/* [데미지 연출: 떠오르는 하트] */
.damage-heart-effect {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    z-index: 999;
    pointer-events: none; /* 클릭 방해 안 함 */
    animation: floatUpFade 1.5s forwards ease-out;
}

@keyframes floatUpFade {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); } /* 쿵! 커짐 */
    100% { opacity: 0; transform: translate(-50%, -200%) scale(1); } /* 위로 사라짐 */
}

/* [넉백 효과: 화면 흔들림] */
.shake-screen-hard {
    animation: shake-hard 0.5s;
}

/* [추가] 부스터 타이머 배지 스타일 */
.booster-badge {
    display: none; /* 기본은 숨김 */
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    color: #2c3e50;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 0 10px #f1c40f;
    animation: pulse-booster 1.5s infinite;
    margin-left: 10px;
    white-space: nowrap;
}

@keyframes pulse-booster {
    0% { transform: scale(1); box-shadow: 0 0 5px #f1c40f; }
    50% { transform: scale(1.05); box-shadow: 0 0 15px #f39c12; }
    100% { transform: scale(1); box-shadow: 0 0 5px #f1c40f; }
}

/* 천사 둥둥 떠다니기 효과 */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* [디자인] 메인 성 이미지 액자 스타일 */
.castle-frame {
    width: 240px;              /* 액자 너비 */
    height: 240px;             /* 액자 높이 (정사각형) */
    margin: 20px auto;         /* 화면 중앙 정렬 */
    
    border: 6px solid #f1c40f; /* 두툼한 황금색 테두리 */
    border-radius: 20px;       /* 부드러운 둥근 모서리 */
    
    background-color: #202b38; /* 이미지 뒤 배경색 (어두운 남색) */
    box-shadow: 0 10px 30px rgba(0,0,0,0.6); /* 바닥에 뜨는 진한 그림자 */
    
    overflow: hidden;          /* 이미지가 액자 밖으로 삐져나가지 않게 */
    display: flex;             /* 내용물 가운데 정렬 */
    align-items: center;
    justify-content: center;
    position: relative;        /* 위치 기준점 */
}

/* 액자 안의 이미지 스타일 */
.castle-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;         /* 액자에 꽉 차게 이미지 비율 자동 조절 */
    display: block;
}

/* [수정] 액자 하단 모서리 - 각도 수정 완료 (모서리 안쪽으로 꽉 차게) */
.castle-frame::before, 
.castle-frame::after {
    content: '';
    position: absolute;
    bottom: -2px;           /* 액자 바닥에 딱 맞춤 */
    width: 70px;            /* 장식 크기 */
    height: 70px;           
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(3px 5px 5px rgba(0,0,0,0.5)); /* 그림자 효과 */
}

/* 1. 왼쪽 아래 장식 (◤ 모양) */
.castle-frame::before {
    left: -2px;
    /* [수정] 45도 방향: 왼쪽 아래(시작)에서 오른쪽 위(투명)로 */
    background: linear-gradient(27deg, #c0392b 0%, #f1c40f 40%, #f1c40f 50%, transparent 50%);
    border-bottom-left-radius: 18px; 
}

/* 2. 오른쪽 아래 장식 (◥ 모양) */
.castle-frame::after {
    right: -2px;
    /* [수정] -45도 방향: 오른쪽 아래(시작)에서 왼쪽 위(투명)로 */
    background: linear-gradient(-27deg, #c0392b 0%, #f1c40f 40%, #f1c40f 50%, transparent 50%);
    border-bottom-right-radius: 18px;
}

/* [디자인] 액자 하단 중앙 장식 (빈 공간 채우기) */
.frame-center-decor {
    position: absolute;
    bottom: -4px;              /* 코너 장식과 높이 맞춤 */
    left: 50%;                 /* 가운데 정렬 시작점 */
    transform: translateX(-50%); /* 정확히 정중앙으로 이동 */
    
    width: 110px;              /* 너비 (빈 공간에 맞춰 조절 가능) */
    height: 20px;              /* 높이 */
    z-index: 11;               /* 코너 장식보다 더 위에 오게 */
    
    /* 붉은색에서 황금색으로 올라오는 그라데이션 */
    background: linear-gradient(to top, #c0392b 0%, #f1c40f 80%);
    
    /* 둥글고 고급스러운 모양 */
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    border: 2px solid #f1c40f; /* 테두리로 마감 */
    border-top: none;          /* 위쪽 선은 없애서 이미지랑 자연스럽게 연결 */
    
    /* 입체감 그림자 */
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* (옵션) 중앙 장식에 작은 보석 박기 */
.frame-center-decor::after {
    content: '◈';             /* 다이아몬드 문양 */
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    text-shadow: 0 0 5px #f1c40f;
}

/* [최종] 여정 시작 버튼 */
#start-journey-btn {
    width: 200px !important;
    padding: 12px 0 !important;
    margin-top: 5px !important;
    margin-bottom: 10px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    font-size: 1.1rem !important;
    font-weight: bold !important;
    cursor: pointer !important;
    border: none !important;
    border-radius: 30px !important;
    
    /* 지파 색상 기반 배경 */
    background: linear-gradient(135deg, rgba(var(--home-btn-a-rgb), 0.95) 0%, rgba(var(--home-btn-b-rgb), 0.95) 100%) !important;
    color: #fff !important;
    
    /* 검은색 그림자 적용 */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* 버튼 호버 효과 */
#start-journey-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6) !important;
    background: linear-gradient(135deg, rgba(var(--home-btn-a-rgb), 1) 0%, rgba(var(--home-btn-b-rgb), 1) 100%) !important;
}

/* 버튼 눌렀을 때 효과 */
#start-journey-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

/* [3단계: 바이블 타워 게임 스타일 수정] */

/* 말씀 기록판 (게임 내 상단 고정) */
#tower-text-display {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 25%; /* 상단 25% 차지 */
    background: rgba(0, 0, 0, 0.3); /* 배경을 조금 더 어둡게 */
    border-bottom: 2px solid rgba(255,255,255,0.1);
    z-index: 20; /* 블록보다 위에 표시 */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto; /* 내용 많으면 스크롤 */
    font-family: 'Noto Serif KR', serif;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* 기록판의 단어 스타일 */
.tower-word-slot {
    margin: 2px 4px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.2); /* 평소엔 흐릿하게 */
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

/* 활성화된 단어 (쌓은 후) */
.tower-word-slot.active {
    color: #f1c40f; /* 황금색 */
    font-weight: bold;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
    border-bottom: none;
    transform: scale(1.1);
}

/* 움직이는 크레인 블록 (위치 조정) */
#moving-block {
    position: absolute;
    /* [수정] 기록판(25%) 아래에서 생성되도록 위치를 내림 */
    top: 30%; 
    height: 40px;
    background: #e74c3c;
    color: white;
    display: flex; align-items: center; justify-content: center;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    white-space: nowrap;
    padding: 0 15px;
    z-index: 10;
    border: 2px solid white;
}

/* 게임 메시지 위치 조정 */
#tower-msg {
    position: absolute;
    /* [수정] 기록판 아래, 크레인 위에 메시지 표시 */
    top: 26%; 
    width: 100%;
    text-align: center;
    color: #2c3e50;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 0 0 5px white;
    z-index: 15;
}

/* [모드 선택 팝업 스타일] */
#mode-select-modal .result-card {
    background: linear-gradient(135deg, #fff 0%, #f4f6f7 100%);
    border: 1px solid #bdc3c7;
    max-width: 320px;
}

.mode-btn {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 15px;
    border: none;
    text-align: left;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
    overflow: hidden;
}

.mode-btn:active { transform: scale(0.98); }

/* 일반 모드 버튼 */
.mode-normal {
    background: white;
    border: 2px solid #bdc3c7;
    color: #2c3e50;
    box-shadow: 0 4px 0 #95a5a6;
}
.mode-normal .badge { background: #95a5a6; }

/* 빠른 복습 버튼 */
.mode-quick {
    background: #fff9c4; /* 연한 노랑 */
    border: 2px solid #f1c40f;
    color: #d35400;
    box-shadow: 0 4px 0 #f39c12;
}
.mode-quick .badge { background: #f1c40f; color: #d35400; }

.mode-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    width: 40px;
    text-align: center;
}
.mode-info { flex: 1; }
.mode-title { font-weight: bold; font-size: 1.1rem; margin-bottom: 3px; }
.mode-desc { font-size: 0.8rem; opacity: 0.8; }
.mode-tag {
    font-size: 0.7rem; font-weight: bold;
    padding: 2px 6px; border-radius: 4px;
    background: rgba(0,0,0,0.1);
    display: inline-block; margin-bottom: 2px;
}

/* [오늘 완료 스테이지 스타일] */
.stage-item.today-clear {
    border: 2px solid #f1c40f !important; /* 황금 테두리 강제 적용 */
    background: linear-gradient(to right, #fff, #fff9c4); /* 은은한 황금빛 배경 */
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.4); /* 번쩍이는 효과 */
    position: relative; /* 배지 위치 잡기용 */
    overflow: hidden;   /* 배지가 둥근 모서리를 넘지 않게 */
}

/* 오른쪽 상단 '오늘 완료' 배지 */
.today-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 4px 10px;
    border-bottom-left-radius: 10px; /* 왼쪽 아래만 둥글게 깎음 */
    box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
    z-index: 1;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

/* [잊혀가는 말씀 스타일] */
.stage-item.forgotten-clear {
    border: 2px solid #9b59b6 !important; /* 보라색 테두리 */
    background: linear-gradient(to right, #fff, #f4ecf7);
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.4);
    position: relative;
    overflow: hidden;
}

.forgotten-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 4px 10px;
    border-bottom-left-radius: 10px;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
    z-index: 1;
}

/* [기억 레벨 배지 스타일] */
.mem-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    margin-right: 5px;
    margin-bottom: 3px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

/* 레벨별 색상 */
.mem-lv-low { background-color: #2ecc71; border: 1px solid #27ae60; } /* Lv.1~2 (초록) */
.mem-lv-mid { background-color: #3498db; border: 1px solid #2980b9; } /* Lv.3~4 (파랑) */
.mem-lv-high { background-color: #e74c3c; border: 1px solid #c0392b; } /* Lv.5+ (빨강) */

/* [보스 사망 효과] */
@keyframes boss-death-spin {
    0% { 
        transform: scaleX(-1) scale(1) rotate(0deg); 
        opacity: 1; 
        filter: none; 
    }
    20% { 
        transform: scaleX(-1) scale(1.2) rotate(-20deg); /* 마지막 발악 (커짐) */
        filter: sepia(1) saturate(1000%) hue-rotate(-50deg) contrast(2); /* 시뻘겋게 변함 */
    }
    100% { 
        transform: scaleX(-1) scale(0) rotate(720deg); /* 뱅글뱅글 돌며 소멸 */
        opacity: 0; 
        filter: grayscale(100%); /* 흑백이 됨 */
    }
}

.boss-die-effect {
    /* 기존 둥둥 뜨는 애니메이션 무시하고 사망 연출 적용 */
    animation: boss-death-spin 1.5s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards !important;
    pointer-events: none; /* 클릭 불가 */
}

/* [듀오링고 스타일 마일스톤 팝업 CSS] */
#milestone-overlay {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000; /* 최상단 */
    align-items: center; justify-content: center;
    flex-direction: column;
    overflow: hidden;
}
/* 회전하는 광채 (Sunburst) */
.sunburst {
    position: absolute;
    width: 200vmax; height: 200vmax;
    background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.1) 0deg, rgba(255, 255, 255, 0.1) 15deg, transparent 15deg, transparent 30deg);
    animation: rotate-sunburst 20s linear infinite;
    z-index: 0;
}
@keyframes rotate-sunburst { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* 메달 카드 및 애니메이션 */
.milestone-card {
    position: relative; z-index: 10;
    background: white; width: 300px; padding: 30px 20px;
    border-radius: 25px; text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 4px solid #f1c40f;
    transform: scale(0);
    animation: elastic-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes elastic-pop { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.milestone-icon { font-size: 5rem; margin-bottom: 10px; display: inline-block; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2)); animation: float-icon 3s ease-in-out infinite; }
@keyframes float-icon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.milestone-title { font-size: 1.5rem; font-weight: 900; color: #f39c12; margin-bottom: 5px; text-transform: uppercase; letter-spacing: -1px; }
.milestone-desc { font-size: 1rem; color: #2c3e50; font-weight: bold; margin-bottom: 20px; }
.milestone-reward { background: #fef9e7; color: #d35400; padding: 10px; border-radius: 10px; font-weight: bold; margin-bottom: 20px; border: 1px dashed #f39c12; }
.btn-get-reward { background: #2ecc71; color: white; border: none; padding: 15px 40px; border-radius: 50px; font-size: 1.2rem; font-weight: bold; box-shadow: 0 4px 0 #27ae60; cursor: pointer; width: 100%; transition: transform 0.1s; }
.btn-get-reward:active { transform: translateY(4px); box-shadow: none; }

/* [추가] 성전 뷰어 네비게이션 스타일 */
.castle-nav-btn {
    background: rgba(0,0,0,0.5);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    z-index: 20;
}
.castle-nav-btn:hover { background: rgba(241, 196, 15, 0.8); color: #2c3e50; }
.castle-nav-btn:disabled { opacity: 0; cursor: default; pointer-events: none; }

/* [추가] 과거 회상 필터 (세피아 톤) */
.memory-filter img {
    filter: sepia(0.6) contrast(0.9) !important; /* 빛바랜 사진 느낌 */
}

/* 과거 표시용 배지: DOM에 직접 추가하여 기존 장식을 덮지 않도록 처리 */
.past-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #ffd700;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 10px;
    pointer-events: none;
    z-index: 12; /* 장식보다 위에 표시 */
}

/* =========================================
   [아이폰 미니(작은 화면) 전용 긴급 패치]
   ========================================= */

/* 1. Step 2 화면 비율 조정 (3번 문제 해결) */
/* 위쪽(정답 칸)은 작게, 아래쪽(단어 선택)은 넓게 */
.reading-card {
    /* 기존 크기보다 조금 줄임 */
    padding: 15px !important;
    margin-bottom: 10px !important;
    font-size: 1.1rem !important; /* 글자 크기 살짝 축소 */
    max-height: 30vh; /* 화면 높이의 30%만 차지하게 제한 */
    overflow-y: auto; /* 내용이 길면 그 안에서 스크롤 */
}

/* 2. 정답 입력 박스 넓히기 (4번, 5번 문제 해결) */
.answer-zone {
    width: 98% !important; /* 90% -> 98%로 확장 (옆 공간 최대한 활용) */
    padding: 10px 5px !important; /* 패딩을 줄여서 내부 공간 확보 */
    
    /* 높이 문제 해결: 고정 높이가 아니라 내용에 따라 늘어나게 */
    height: auto !important; 
    min-height: 100px;
    max-height: 35vh !important; /* 화면의 35% 이상 가지 않도록 제한 */
    overflow-y: auto !important; /* 블록이 많아지면 스크롤 가능 */
    
    /* 블록 정렬 방식 개선 */
    gap: 5px !important; /* 블록 사이 간격을 좁힘 */
    align-content: flex-start !important; /* 위에서부터 차곡차곡 쌓임 */
}

/* 3. 블록 크기 다이어트 (좁은 화면에서 블록이 넘치는 것 방지) */
.word-block {
    padding: 8px 10px !important; /* 블록 뚱뚱함 줄이기 */
    font-size: 0.95rem !important; /* 글자 크기 살짝 줄이기 */
    margin: 2px !important; /* 블록 간 간격 미세 조정 */
    max-width: 100%; /* 화면 밖으로 튀어나가지 않게 */
}

/* 4. 하단 컨트롤 영역 안전거리 확보 */
.battle-control {
    /* 아이폰 하단 바(Home indicator)에 버튼이 가려지지 않게 */
    padding-bottom: 30px !important; 
}

/* [패치] 힌트 버튼 글자 깨짐 및 레이아웃 수정 */
.item-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* ★ 핵심: 글자가 아래로 절대 떨어지지 않게 함 */
    white-space: nowrap !important; 
    
    /* ★ 핵심: 버튼의 최소 길이를 확보해서 여유를 줌 */
    min-width: 85px !important; 
    
    /* 내부 간격 조정 */
    padding: 6px 10px !important;
    gap: 4px !important; /* 아이콘과 글자 사이 간격 */
}

/* 훈련 모드 헤더의 아이템 버튼 영역 정렬 */
.training-header .item-btn {
    flex-shrink: 0; /* 버튼이 찌그러지지 않게 방지 */
}

/* 보석 아이콘과 숫자도 한 세트로 묶기 */
.item-btn span, .item-btn div {
    display: inline-block;
    white-space: nowrap;
}

/* 헤더 내부 요소들이 서로 겹치지 않게 간격 조정 */
.training-header {
    gap: 10px;
    padding: 10px 15px !important;
}

/* Floating booster timer button */
.booster-float {
    position: fixed;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 300;
    user-select: none;
    touch-action: none;
}
.booster-float-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
}
.booster-float-btn:active {
    transform: scale(0.95);
}
.booster-float-panel {
    display: none;
    background: rgba(44, 62, 80, 0.95);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.6);
    border-radius: 16px;
    padding: 6px 10px;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.booster-float.open .booster-float-panel {
    display: inline-block;
}

/* 도움말 스타일 */
.help-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 4px solid #3498db;
}

.help-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 8px;
}

.help-desc {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

/* 여정 시작 버튼 */
.btn-main-action {
    background: linear-gradient(135deg, rgba(var(--home-btn-a-rgb), 0.95) 0%, rgba(var(--home-btn-b-rgb), 0.95) 100%);
    color: white;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 18px 50px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-main-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    background: linear-gradient(135deg, rgba(var(--home-btn-a-rgb), 1) 0%, rgba(var(--home-btn-b-rgb), 1) 100%);
}

.btn-main-action:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* 월말 알림 펄스 애니메이션 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 10px rgba(231,76,60,0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 15px rgba(231,76,60,0.6);
    }
}

.battle-help-btn {
    background: rgba(255,255,255,0.1);
    color: #ecf0f1;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 6px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.battle-help {
    width: 100%;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
    color: #ecf0f1;
    font-size: 0.75rem;
    line-height: 1.4;
    text-align: right;
    border: 1px solid rgba(255,255,255,0.1);
}

.battle-help.hidden {
    display: none;
}

/* 망각 위험 모달 스크롤바 디자인 */
#forgotten-stages-list::-webkit-scrollbar {
    width: 6px;
}
#forgotten-stages-list::-webkit-scrollbar-track {
    background: rgba(241, 196, 15, 0.1); 
    border-radius: 10px;
}
#forgotten-stages-list::-webkit-scrollbar-thumb {
    background: #f1c40f; 
    border-radius: 10px;
}
#forgotten-stages-list::-webkit-scrollbar-thumb:active {
    background: #f39c12; 
}
/* ⚠️ 2초 전 경고 애니메이션 (상자용) */
@keyframes warningBlink {
    0% { border-color: #e74c3c; box-shadow: 0 0 15px rgba(231, 76, 60, 0.8); background-color: rgba(231, 76, 60, 0.1); }
    50% { border-color: #f39c12; box-shadow: 0 0 5px rgba(243, 156, 18, 0.5); background-color: transparent; }
    100% { border-color: #e74c3c; box-shadow: 0 0 15px rgba(231, 76, 60, 0.8); background-color: rgba(231, 76, 60, 0.1); }
}

.scroll-warning {
    animation: warningBlink 0.6s infinite !important;
    color: #e74c3c !important;
    font-weight: bold;
}

/* ⚠️ 2초 전 경고 애니메이션 (정답 버튼 힌트용 - 선택 사항) */
@keyframes hintBlink {
    0% { transform: scale(1); box-shadow: 0 4px 0px #bdc3c7; }
    50% { transform: scale(1.05); box-shadow: 0 0 15px #f1c40f, 0 4px 0px #f39c12; border-color: #f1c40f; }
    100% { transform: scale(1); box-shadow: 0 4px 0px #bdc3c7; }
}

.hint-blink {
    animation: hintBlink 0.6s infinite !important;
}

/* 1. 홈 화면이 켜져 있을 때는 하단 네비바를 강제로 숨김 */
#home-screen.active ~ .bottom-nav { 
    display: none !important; 
}

/* 2. 상점, 미션, 도감 등에서 내용이 네비바에 가려지지 않게 하단 여백 추가 */
#shop-screen, #mission-screen, #life-book-screen, #ranking-screen {
    padding-bottom: 90px !important;
}

/* 3. 화면 맨 밑의 '돌아가기' 고정 버튼을 네비바 위로 끌어올림 */
.button-area-static {
    bottom: 70px !important; /* 네비바 높이만큼 위로 띄움 */
    z-index: 100;
}