@import url('https://fonts.googleapis.com/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@1,600&display=swap');

:root { 
    --cursor-x: 50%; 
    --cursor-y: 50%; 
    /* Instagram Brand Colors */
    --primary-color: #d62976; /* Instagram Pink */
    --accent-color: #962fbf; /* Instagram Purple */
    --insta-orange: #fa7e1e;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
}

html { scroll-behavior: smooth; }
body { 
    font-family: 'Pretendard', sans-serif; 
    background: #fdf2f8; /* 아주 연한 핑크 톤 배경 */
    color: var(--text-main); 
    overflow-x: hidden; 
    letter-spacing: -0.02em; 
}

/* 🧭 네비게이션 (상단 고정 & 최상위) */
nav { 
    position: fixed; 
    top: 0; left: 0; width: 100%;
    padding: 1.5rem 4rem; 
    background: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(20px); 
    border-bottom: 1px solid rgba(0,0,0,0.05); 
    z-index: 9999 !important; 
    display: flex; justify-content: space-between; align-items: center;
}
.nav-link { color: #64748b; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; transition: color 0.2s; }
.nav-link:hover { 
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 🌅 인스타그램 오로라 배경 */
.fluid-bg { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; 
    background: radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(214, 41, 118, 0.15) 0%, transparent 40%), 
                radial-gradient(circle at 80% 20%, rgba(250, 126, 30, 0.1) 0%, transparent 50%); 
    transition: background 0.3s ease-out; 
}
.aurora-blur { 
    position: fixed; width: 140vw; height: 140vh; top: -20vh; left: -25vw; z-index: -2; 
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e6 40%, #fae8ff 100%); 
    filter: blur(80px); opacity: 0.8; 
}

/* 💎 글래스 카드 */
.mag-card { 
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid white; 
    border-radius: 24px; 
    padding: 2rem; 
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.05); 
    transition: all 0.3s ease; 
    width: 100%; box-sizing: border-box;
}
.mag-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08); 
}

/* 🎬 Player Canvas */
#studioContainer { 
    position: relative; 
    width: 100%; max-width: 900px; 
    margin: 0 auto; 
    transition: all 0.5s ease; 
    z-index: 10; 
}
.aspect-shorts { aspect-ratio: 9 / 16; max-width: 400px !important; }
.aspect-long { aspect-ratio: 16 / 9; max-width: 900px !important; }
.canvas-wrapper { 
    position: relative; width: 100%; height: 100%; background: #000; 
    border-radius: 20px; overflow: hidden; 
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.2); 
    border: 8px solid #fff;
}
canvas { width: 100%; height: 100%; display: block; object-fit: contain; }

/* 🎛️ 포맷 버튼 */
.format-toggle-container { display: flex; justify-content: center; gap: 1rem; margin-bottom: 2rem; }
.format-btn { 
    display: flex; items-center justify-center gap-2 px-6 py-3 rounded-full 
    text-xs font-bold uppercase tracking-wider transition-all duration-300 relative z-10;
    background: white; 
    color: var(--text-sub); 
    border: 2px solid #f1f5f9;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.format-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.format-btn.active { 
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); 
    color: white; 
    border-color: transparent;
    box-shadow: 0 8px 15px rgba(214, 41, 118, 0.3); 
    transform: scale(1.05);
}

/* 🖼️ 업로드 & 갤러리 */
#dropZone { 
    background: rgba(255, 255, 255, 0.5); 
    border: 2px dashed #fbcfe8; /* 연한 핑크 테두리 */
    border-radius: 20px; 
    transition: all 0.3s; 
    padding: 3rem;
    cursor: pointer;
    text-align: center;
}
#dropZone:hover { 
    border-color: var(--primary-color); 
    background: rgba(255, 255, 255, 0.8); 
    transform: scale(1.01);
}
#galleryGrid { 
    display: flex; overflow-x: auto; gap: 10px; padding: 15px 0; 
    scrollbar-width: none; -ms-overflow-style: none;
    width: 100%; box-sizing: border-box;
}
#galleryGrid::-webkit-scrollbar { display: none; }
.gallery-item { 
    flex: 0 0 auto; width: 70px; height: 70px; 
    border-radius: 12px; overflow: hidden; 
    border: 2px solid white; 
    transition: transform 0.2s; position: relative; 
    background: #fff0f5;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.gallery-item:hover { transform: scale(1.05); border-color: var(--primary-color); z-index: 10; }
.btn-delete-img {
    background: rgba(0, 0, 0, 0.6); color: white;
    transition: all 0.2s;
}

/* -------------------------------------------------------- */
/* [틱톡 스타일 버튼 그리드 - 인스타 컬러 적용] */
/* -------------------------------------------------------- */
/* 1. 그리드 컨테이너: 버튼들이 찌그러지지 않게 최소 너비(80px) 보장 */
.motion-grid, .voice-opt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); 
    gap: 12px;
    width: 100%;
}

/* 2. 카드 스타일: 정사각형 비율(aspect-ratio)을 유지하며 아이콘과 글자를 세로로 정렬 */
.motion-opt, .voice-opt {
    display: flex !important;
    flex-direction: column !important; /* 가로 배열 방지, 무조건 세로 정렬 */
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: white;
    border-radius: 24px; /* 캡쳐와 같은 둥근 사각형 */
    border: 2px solid #f1f5f9;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 1 / 1.1; /* [핵심] 정사각형 형태 유지 */
    height: auto;
    cursor: pointer;
}

/* 3. 아이콘 박스: flex-shrink를 부여해 절대 찌그러지지 않게 고정 */
.icon-box {
    width: 42px;
    height: 42px;
    flex-shrink: 0 !important; /* [핵심] 어떤 상황에서도 아이콘 형태 고정 */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 8px; /* [핵심] 아이콘과 글자가 겹치지 않게 간격 확보 */
    font-size: 1.3rem;
    color: #64748b;
    transition: all 0.3s;
}

/* 4. 활성화(Active) 상태: 아이콘이 흰색으로 사라지는 문제 해결 */
.motion-opt.active, .voice-opt.active {
    border-color: var(--primary-color) !important;
    background: #fffafa !important; /* 매우 연한 배경 */
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

/* [중요] 선택된 상태에서도 아이콘이 선명하게 보이도록 색상 고정 */
.active .icon-box {
    background: #fee2e2; /* 연한 레드/핑크 배경 */
    color: var(--primary-color) !important; /* 아이콘을 흰색이 아닌 브랜드 컬러로 유지 */
}

.active i {
    color: var(--primary-color) !important; /* 폰트어썸 아이콘 색상 강제 적용 */
}

/* 5. 하단 텍스트 스타일: 텍스트가 아이콘 위로 올라오지 않게 설정 */
.motion-opt span, .voice-opt span {
    font-size: 10.5px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap; /* 글자 줄바꿈 방지 */
    text-align: center;
    line-height: 1.2;
}

.active span {
    color: var(--primary-color) !important; /* 선택 시 텍스트 색상 강조 */
}
/* ======================================================== */
/* [1. 공통 & PC 스타일] - 화면 너비 769px 이상일 때 적용 */
/* ======================================================== */
@media (min-width: 769px) {
    header h2 {
        font-size: 3.5rem !important; /* PC는 시원하게 대형 폰트 */
        line-height: 1.1 !important;
        font-weight: 900 !important;
        letter-spacing: -0.05em !important;
        margin-bottom: 2rem !important;
        display: block !important;
        text-align: center;
    }
    header p {
        font-size: 1.25rem !important; /* PC 본문 크기 */
        line-height: 1.6 !important;
        padding: 0 2rem !important;
        text-align: center;
        opacity: 0.9;
    }
    /* 안내 박스 PC 크기 유지 */
    header .inline-flex { padding: 0.4rem 1rem !important; margin-bottom: 2rem !important; }
    header .bg-cyan-50, header .bg-white\/60 { padding: 1rem 2.5rem !important; }
}

/* ======================================================== */
/* [2. 모바일 스타일] - 화면 너비 768px 이하일 때만 적용 */
/* ======================================================== */
@media (max-width: 768px) {
    /* 상단 여백 및 내비게이션 최적화 */
    .h-24 { height: 0.5rem !important; } 
    .pt-20 { padding-top: 4.5rem !important; } 
    nav { padding: 0.6rem 1rem !important; }

    /* 헤더 50% 축소 */
    header.mb-12, header.mb-10 { margin-bottom: 1.2rem !important; }

    header h2 { 
        font-size: 0.9rem !important; /* 요청하신 대로 아주 작게 고정 */
        line-height: 1.2 !important; 
        margin-bottom: 0.4rem !important;
        letter-spacing: -0.02em !important;
        font-weight: 800 !important;
    }

    header p { 
        font-size: 0.45rem !important; /* 본문 50% 축소 */
        line-height: 1.4 !important;
        padding: 0 1rem !important;
        opacity: 0.8 !important;
    }

    /* 틱톡/유튜브/인스타 공통 요소들 모바일 축소 */
    header .inline-flex { padding: 0.2rem 0.6rem !important; margin-bottom: 0.8rem !important; }
    header .inline-flex span { font-size: 7px !important; }
    header i { font-size: 1rem !important; } /* 아이콘 크기 축소 */
    header .bg-cyan-50, header .bg-white\/60 { padding: 0.5rem 1rem !important; margin-bottom: 1rem !important; }
    header .text-sm { font-size: 8px !important; } /* 9:16 안내 텍스트 축소 */

    /* 4. 버튼 텍스트 중앙 정렬 */
    .format-btn {
        display: flex !important;
        justify-content: center !important; 
        align-items: center !important;     
        width: 100% !important;             
        padding: 14px 0 !important;         
        text-align: center !important;      
        gap: 8px !important;               
    }
    
    .format-toggle-container {
        display: flex !important;
        width: 100% !important;
        gap: 10px !important;
        padding: 0 !important;
    }

    /* 5. 가이드 텍스트 숨김 */
    #nextStepGuide, .next-step-guide, #guideLabel, #guideMainMsg {
        display: none !important;
    }
    body > p.text-slate-400.italic { display: none !important; }

    /* 6. 메인 컨테이너 여백 제거 (좌우 밀림 방지) */
    main.container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }
    main .px-12 { padding: 0 !important; } 

    /* 7. 카드 및 그리드 최적화 */
    .mag-card { 
        padding: 1.5rem 1.2rem !important; 
        width: 100% !important; 
        box-sizing: border-box !important;
    }
    .motion-grid, .voice-opt-grid { 
        grid-template-columns: repeat(4, 1fr) !important; 
        gap: 6px !important; 
    }
    .motion-opt, .voice-opt {
        padding: 8px 2px !important;
        min-height: 70px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }
    .icon-box { margin-bottom: 4px !important; }
    .motion-opt span, .voice-opt span {
        font-size: 9px !important;
        transform: scale(0.9);
        display: block !important;
        width: 100% !important;
        text-align: center !important;
    }
}