@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%; 
    /* YouTube Brand Colors */
    --primary-color: #FF0000; /* YouTube Red */
    --accent-color: #282828; /* YouTube Dark Gray */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --text-main: #0f0f0f;
    --text-sub: #606060;
}

html { scroll-behavior: smooth; }

body { 
    font-family: 'Pretendard', sans-serif; 
    background: #f9f9f9; /* 유튜브 특유의 밝은 회색 배경 */
    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.95); 
    backdrop-filter: blur(10px); 
    border-bottom: 1px solid rgba(0,0,0,0.08); 
    z-index: 9999 !important; 
    display: flex; justify-content: space-between; align-items: center;
}
.nav-link { color: #606060; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; transition: color 0.2s; text-decoration: none; }
.nav-link:hover { color: var(--primary-color); }

/* 🌅 배경 효과 (레드 톤 오로라) */
.fluid-bg { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; 
    background: radial-gradient(circle at 20% 20%, rgba(255, 0, 0, 0.03) 0%, transparent 40%), 
                radial-gradient(circle at 80% 80%, rgba(40, 40, 40, 0.03) 0%, transparent 40%); 
}
.aurora-blur { 
    position: fixed; width: 140vw; height: 140vh; top: -20vh; left: -25vw; z-index: -2; 
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%); 
    filter: blur(80px); opacity: 0.6; 
}

/* 💎 카드 디자인 */
.mag-card { 
    background: rgba(255, 255, 255, 0.8); 
    border: 1px solid #e5e5e5; 
    border-radius: 24px; 
    padding: 2rem; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.02); 
    transition: all 0.3s ease; 
    width: 100%; box-sizing: border-box; 
}
.mag-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05); 
    border-color: #ffcccc;
}

/* 🎬 플레이어 캔버스 (흰색 테두리) */
#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-wide { aspect-ratio: 16 / 9; max-width: 900px !important; }

.canvas-wrapper { 
    position: relative; width: 100%; height: 100%; background: #000; 
    border-radius: 24px; overflow: hidden; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.15); 
    border: 10px solid #ffffff; 
}
canvas { width: 100%; height: 100%; display: block; object-fit: contain; }

/* 🖼️ 업로드 영역 */
#dropZone { 
    background: #fff; 
    border: 2px dashed #e5e5e5; 
    border-radius: 20px; 
    transition: all 0.3s; 
    padding: 3rem; 
    cursor: pointer; 
    text-align: center;
}
#dropZone:hover { 
    border-color: var(--primary-color); 
    background: #fffafa; 
    transform: scale(1.01);
}
#galleryGrid { 
    display: flex; overflow-x: auto; gap: 10px; padding: 15px 0; 
    width: 100%; box-sizing: border-box;
    scrollbar-width: none;
}
#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: #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.gallery-item:hover { transform: scale(1.05); border-color: var(--primary-color); z-index: 10; }
.btn-delete-img {
    background: rgba(0, 0, 0, 0.7); color: white;
    transition: all 0.2s; position: absolute; top: 0; right: 0; padding: 2px 6px; cursor: pointer;
}

/* -------------------------------------------------------- */
/* [최종 수정] 비주얼 디렉팅 & 나레이션 버튼 스타일 */
/* -------------------------------------------------------- */
.motion-grid, .voice-opt-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); 
    gap: 10px; 
    width: 100%;
}

.motion-opt, .voice-opt { 
    display: flex; 
    flex-direction: column; /* 세로 정렬 */
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 12px; 
    border-radius: 18px; 
    border: 2px solid transparent; 
    background: white; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); 
    user-select: none;
    height: 100%;
}

/* [중요] 아이콘 박스 기본 스타일 */
.icon-box { 
    width: 40px; 
    height: 40px; 
    flex-shrink: 0; /* 찌그러짐 방지 */
    border-radius: 12px; 
    background: #f8fafc; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.2rem; 
    color: #64748b; 
    transition: all 0.3s;
    border: 1px solid #f1f5f9;
}
/* 성우 선택용 아이콘 스타일 보정 */
.voice-opt i { font-size: 1.2rem; color: #64748b; transition: all 0.3s; }

/* 🔴 [핵심 수정] 선택된 상태 (아이콘이 선명하게 보이도록 변경) */
.motion-opt.active, .voice-opt.active { 
    border-color: var(--primary-color) !important; 
    background: #fef2f2 !important; /* 배경을 아주 연한 핑크로 */
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(255, 0, 0, 0.1) !important;
}

.active .icon-box { 
    background: #fee2e2; /* 아이콘 박스 배경을 연한 빨강으로 */
    color: var(--primary-color); /* 아이콘 색상을 진한 빨강으로 고정 */
    border-color: #fecaca;
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.1);
}

.active i { 
    color: var(--primary-color) !important; /* 아이콘이 흰색이 되지 않도록 강제 적용 */
    transform: scale(1.1);
}

.motion-opt span, .voice-opt span { 
    font-size: 10px; 
    font-weight: 700; 
    color: #64748b; 
    letter-spacing: -0.02em; 
    white-space: nowrap;
}

.active span { 
    color: var(--primary-color); /* 텍스트도 진한 빨간색으로 */
    font-weight: 800; 
}

/* 📝 입력창 스타일 유지 */
input, textarea, select { 
    width: 100%; background: #fff; border: 1px solid #ddd; 
    border-radius: 12px; padding: 14px 16px; font-size: 13px; 
    outline: none; transition: all 0.2s; box-sizing: border-box;
}
input:focus, textarea:focus, select:focus { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.05); 
}

/* 🚀 Start 버튼 (유튜브 그라데이션) */
.btn-fluid { 
    width: 100%; 
    background: linear-gradient(135deg, #FF0000 0%, #cc0000 100%); 
    color: white; font-weight: 900; font-size: 18px; padding: 20px; 
    border-radius: 99px; border: none; cursor: pointer; 
    box-shadow: 0 10px 25px rgba(255, 0, 0, 0.25); 
    transition: all 0.3s; 
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-fluid:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 15px 35px rgba(255, 0, 0, 0.35); 
}

/* 🎤 렌더링 버튼 스타일 유지 */
.btn-render { 
    width: 100%; background: #282828; color: white; 
    font-weight: 800; font-size: 13px; padding: 16px; 
    border-radius: 14px; border: none; cursor: pointer; 
    transition: all 0.2s; margin-top: 10px;
}
.btn-render:hover { background: #000; }

/* 🛠️ Script Tools 스타일 유지 */
.script-tools { display: flex; gap: 8px; margin-bottom: 15px; }
.script-tool-btn { 
    flex: 1; padding: 12px; border-radius: 12px; 
    background: white; border: 1px solid #eee;
    color: #555; font-size: 11px; font-weight: 700;
    cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.script-tool-btn:hover { border-color: var(--primary-color); color: var(--primary-color); background: #fff5f5; }

/* 📊 AI 결과 카드 및 태그 스타일 유지 */
.ai-result-card { 
    background: #fff; border: 1px solid #eee; 
    border-radius: 16px; padding: 20px; margin-bottom: 12px; 
}
.ai-result-label { 
    color: var(--primary-color); font-size: 11px; font-weight: 800; 
    display: block; margin-bottom: 8px; 
}
.ai-result-content { color: #333; font-size: 13px; line-height: 1.6; }
.ai-tag-bubble { 
    display: inline-block; background: #fef2f2; color: #cc0000; 
    border: 1px solid #fecaca; padding: 4px 10px; border-radius: 20px; 
    font-size: 11px; font-weight: 700; margin: 4px 4px 0 0; 
}


/* ======================================================== */
/* [1. 기본 스타일 - PC 전체화면 기준]                        */
/* ======================================================== */
header h2 {
    font-size: 3.5rem !important; 
    line-height: 1.1 !important;
    font-weight: 900 !important;
    letter-spacing: -0.05em !important;
    margin-bottom: 2rem !important;
    color: #0f0f0f !important;
    text-align: center !important;
}

header p {
    font-size: 1.25rem !important; 
    line-height: 1.6 !important;
    color: #606060 !important;
    padding: 0 2rem !important;
    text-align: center !important;
}

/* ======================================================== */
/* [2. 모바일/분할 화면 스타일 - 768px 이하]                 */
/* 캡처처럼 창을 반으로 나눴을 때 적용되는 구간입니다.             */
/* ======================================================== */
@media (max-width: 768px) {
    /* 🔴 [수정] 헤더가 위에 붙는 현상 해결: 여백 대폭 추가 */
    .h-24 { 
        height: 3rem !important; /* 기존 0.5rem에서 3rem으로 복구 */
    } 
    
    main.container { 
        padding-top: 2rem !important; /* 상단 패딩 추가 */
    }

    header.mb-12 { 
        margin-top: 1rem !important;
        margin-bottom: 1.5rem !important; 
    }

    /* 🔴 [수정] 틱톡과 폰트 크기 통일 (0.9rem -> 1.8rem으로 상향) */
    /* 캡처를 보니 0.9rem은 너무 작습니다. 틱톡과 같은 1.8rem으로 맞춥니다. */
    header h2 { 
        font-size: 1.8rem !important; 
        line-height: 1.3 !important; 
        margin-bottom: 0.5rem !important;
        letter-spacing: -0.02em !important;
    }

    header p { 
        font-size: 0.9rem !important; /* 본문도 틱톡과 동일하게 0.9rem */
        line-height: 1.5 !important;
        padding: 0 1rem !important;
        opacity: 0.8 !important;
    }

    /* 안내 뱃지 크기 조절 */
    header .inline-flex { 
        padding: 0.3rem 0.8rem !important; 
        margin-bottom: 1.5rem !important; 
    }
    header .inline-flex span { font-size: 9px !important; }

    /* 포맷 버튼(Shorts/Wide) 레이아웃 */
    .format-btn {
        padding: 12px 0 !important;
        font-size: 11px !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !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;
    }
    
    /* 혹시 HTML에 직접 텍스트가 노출된 경우를 대비해 body 상단 텍스트 숨김 */
    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;
    }
}