/* ==========================================
   💎 JAP-BONG Premium Design System (v2.0)
   ========================================== */

:root {
    /* 🎨 Color Palette (Modern & Vibrant) */
    --primary: #FF4B4B;
    --primary-gradient: linear-gradient(135deg, #FF4B4B 0%, #FF6B6B 100%);
    --secondary: #1E88E5;
    --accent: #FFD700;

    /* 🌚 Neutral Colors */
    --bg-main: #F8FAFC;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-light: rgba(226, 232, 240, 0.8);

    /* ✨ Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-blur: blur(12px);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* 📏 Layout */
    --header-h: 60px;
    --nav-h: 70px;
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
}

/* 🖼️ Global Fixed Frame Structure - Enforced */
/* 🖼️ Global Fixed Frame Structure - Holy Grail Mobile Emulation */
html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    /* Desktop Workspace Background */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Prevent html scroll */
}

body {
    width: 100%;
    max-width: 480px;
    height: 100%;
    margin: 0 auto;
    /* Center the body */
    padding: 0;
    background-color: #fff;
    color: var(--text-main);
    font-family: 'Noto Sans KR', 'Noto Sans JP', sans-serif;
    -webkit-font-smoothing: antialiased;

    /* Removed transform: translateZ(0) to fix fixed positioning contexts */
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    /* Maintain shadow for desktop look */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.15);
}

/* Media Query: Remove constraints on actual mobile devices */
@media (max-width: 480px) {
    html {
        background-color: #fff;
        display: block;
    }

    body {
        max-width: none;
        box-shadow: none;
        transform: none;
        /* Let fixed elements use viewport */
    }
}

/* Fixed Header - Fixed relative to Viewport, constrained to mobile width */
#app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--header-h);
    z-index: 1000;
    background: var(--primary-gradient);
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--glass-border);
}

/* Fixed Bottom Nav - Fixed relative to Viewport, constrained to mobile width */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-h);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--glass-border);
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    justify-content: space-around;
    align-items: center;
}

/* Main Content Area - Scrollable Middle */
.app-container {
    flex: 1;
    overflow-y: auto;
    /* Scrollable */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    padding-top: calc(var(--header-h) + 10px);
    padding-bottom: calc(var(--nav-h) + 20px);
}

.content-scroll {
    /* Deprecated wrapper, ensuring it doesn't break flow */
    height: 100%;
}

.tab-content {
    min-height: 100%;
    position: relative;
}

/* 3D Flip Animation */
.perspective-1000 {
    perspective: 1000px;
}

.transform-style-3d {
    transform-style: preserve-3d;
}

.backface-hidden {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.rotate-y-180 {
    transform: rotateY(180deg);
}

.card-inner {
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card-flipped .card-inner {
    transform: rotateY(180deg);
}

/* Overlays are now absolute within the viewport (Body) */
.fixed {
    position: absolute !important;
    /* This ensures they don't break out of the transformed body */
}

.fixed.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* 카드 플립 3D */
@keyframes card-flip-in {
    0% {
        transform: perspective(1000px) rotateY(0deg);
    }

    100% {
        transform: perspective(1000px) rotateY(180deg);
    }
}

/* 진행바 채움 애니메이션 */
@keyframes progress-fill {
    from {
        width: 0%;
    }
}

.animate-progress-fill {
    animation: progress-fill 1s ease-out forwards;
}

/* 승리 춤 */
@keyframes victory-dance {

    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(-10deg) scale(1.1);
    }

    50% {
        transform: rotate(10deg) scale(1.05);
    }

    75% {
        transform: rotate(-5deg) scale(1.1);
    }
}

.animate-victory {
    animation: victory-dance 0.8s ease-in-out;
}

/* 레벨업 폭발 효과 */
@keyframes level-up-burst {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.level-up-circle {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.8) 0%, rgba(255, 165, 0, 0.4) 50%, transparent 70%);
    animation: level-up-burst 0.8s ease-out forwards;
    pointer-events: none;
}

/* 학년 카드 호버 그라디언트 */
.grade-card {
    background-size: 200% 200%;
    transition: all 0.3s ease;
}

.grade-card:hover {
    animation: gradient-shift 2s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* 잠금 아이콘 흔들림 */
@keyframes lock-shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-15deg);
    }

    75% {
        transform: rotate(15deg);
    }
}

.lock-shake:hover {
    animation: lock-shake 0.3s ease-in-out;
}

/* ==========================================
   ❄️ Winter Theme & Flow Layout
   ========================================== */

/* 눈 내리는 배경 애니메이션 */
@keyframes snow {
    0% {
        transform: translateY(-10px) translateX(0);
        opacity: 0.8;
    }

    50% {
        transform: translateY(50vh) translateX(20px);
        opacity: 0.6;
    }

    100% {
        transform: translateY(100vh) translateX(-20px);
        opacity: 0;
    }
}

.theme-winter {
    background: linear-gradient(180deg, #e3f2fd 0%, #f1f8e9 100%);
    position: relative;
    overflow-x: hidden;
}

.snowflake {
    position: fixed;
    top: -10px;
    color: white;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 50;
    animation-name: snow;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* Horizontal Flow Container */
.horizontal-flow-container {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 2rem;
    padding: 2rem 1rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    /* Firefox */
    -ms-overflow-style: -ms-autohiding-scrollbar;
    /* Edge */
}

.horizontal-flow-container::-webkit-scrollbar {
    height: 6px;
}

.horizontal-flow-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.horizontal-flow-container::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    border-radius: 20px;
}

/* Flow Card */
.flow-card {
    flex: 0 0 280px;
    scroll-snap-align: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.flow-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #60a5fa;
}

/* Connector Line */
.flow-connector {
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.flow-connector::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: #cbd5e1;
    position: relative;
}

.flow-connector i {
    z-index: 10;
    background: #e3f2fd;
    padding: 0.5rem;
    border-radius: 50%;
    color: #3b82f6;
}

/* ==========================================
   🗾 Japan Travel Layout Enhancements
   ========================================== */

/* Active Step Highlight */
.active-step {
    border: 2px solid var(--primary) !important;
    box-shadow: 0 0 25px rgba(255, 75, 75, 0.2) !important;
    transform: translateY(-6px) scale(1.03) !important;
    z-index: 10;
}

/* Scrollbar Utilities */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Specific POI Card Adjustments */
.poi-card-item {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.poi-card-item:hover {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* Ensure images in slider are consistent */
[id^="slider-"] img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Mobile Frame Handling for Modals */
.fixed.inset-0, .fixed.top-0, .fixed.bottom-0 {
    max-width: 480px;
    left: 50% !important;
    transform: translateX(-50%);
    width: 100%;
}

