/* 
   ====================================================
   행복칠TV 철학자 상담소 - 프리미엄 다크모드 디자인 (index.css)
   ====================================================
*/

/* 모든 요소의 여백을 초기화하고 크기 계산을 직관적으로 만듭니다 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 전체 페이지 배경 및 기본 글꼴 설정 */
body {
    /* 명상과 철학에 어울리는 명조체(Noto Serif KR)를 적용합니다 */
    font-family: 'Noto Serif KR', serif;
    /* 신비로운 심연을 표현하는 어두운 그라데이션 배경입니다 */
    background: radial-gradient(circle at center, #2c1b4d, #0b0710);
    color: #f0f0f0; /* 글씨는 밝은 회색으로 하여 눈을 편안하게 합니다 */
    min-height: 100vh; /* 화면 높이를 100% 꽉 채웁니다 */
    display: flex;
    justify-content: center; /* 가로 가운데 정렬 */
    align-items: center; /* 세로 가운데 정렬 */
    overflow-x: hidden;
}

/* 화면 배경에 깔리는 은은한 빛 효과 (신비로움 추가) */
.background-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1; /* 다른 내용들보다 뒤로 보냅니다 */
    animation: pulse 8s infinite alternate; /* 천천히 커졌다 작아지는 숨쉬기 애니메이션 */
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-50%, -50%) scale(1.1); }
}

/* 메인 컨텐츠 상자 (고급스러운 유리 질감 효과 - Glassmorphism) */
.container {
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.05); /* 반투명한 흰색 배경 */
    backdrop-filter: blur(12px); /* 배경을 흐리게(블러) 처리하여 유리처럼 보이게 합니다 */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1); /* 얇고 투명한 테두리 */
    border-radius: 20px; /* 모서리를 둥글게 */
    padding: 15px 15px; /* 상하좌우 여백을 최대한 줄여 세로 길이를 팍팍 압축합니다 */
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5); /* 입체감을 주는 그림자 */
}

/* 제목 부분 디자인 */
header {
    margin-bottom: 10px; /* 여백 더 축소 */
}

/* 3D 로고 및 캐러셀을 감싸는 전체 컨테이너 */
.circular-logo-container {
    position: relative;
    width: 100%; 
    height: 180px; /* 전체 높이 대폭 축소 (기존 250px -> 180px) */
    margin: 0 auto 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 중앙 로고 이미지 설정 */
.logo-center {
    position: absolute;
    width: 50px; 
    height: 50px;
    border-radius: 10px;
    z-index: 10;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); 
    background: rgba(0, 0, 0, 0.4); 
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateY(-25px); /* 로고를 위로 약 2센티 정도 올림 */
}

.logo-center img {
    width: 90%; 
    height: 90%;
    object-fit: contain; 
}

/* 3D 씬 (퍼스펙티브 제공) */
.scene {
    width: 100%;
    height: 180px;
    perspective: 1000px; 
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    pointer-events: none; 
}

/* 회전하는 캐러셀 트랙 */
.carousel {
    width: 0px; /* 가운데 정렬을 위해 0으로 설정 */
    height: 90px; 
    position: relative;
    transform-style: preserve-3d;
    animation: spin-carousel 120s infinite linear; 
}

@keyframes spin-carousel {
    /* 반지름 축소(220px)에 맞춰 틸트 각도 조절 */
    0% { transform: translateZ(-220px) rotateX(-5deg) rotateY(0deg); }
    100% { transform: translateZ(-220px) rotateX(-5deg) rotateY(-360deg); } 
}

/* 낱글자가 들어가는 각각의 이미지 카드 (포스터) */
.carousel__cell {
    position: absolute;
    height: 90px; /* 높이 축소 */
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    backface-visibility: visible; 
    
    background: linear-gradient(180deg, rgba(20,20,20,0.6) 0%, rgba(50,50,50,0.7) 50%, rgba(20,20,20,0.6) 100%);
    border-left: 1px solid rgba(0,0,0,0.8);
    border-right: 1px solid rgba(255,255,255,0.15); 
    box-shadow: inset 0 0 5px rgba(0,0,0,0.9);
}

.cell-normal {
    width: 54px;
    left: -27px; /* 중앙 정렬 */
}

.cell-english {
    width: 36px;
    left: -18px;
}

.cell-particle {
    width: 18px; /* 조사가 들어간 셀의 넓이를 대폭 축소! */
    left: -9px; /* 중앙 정렬 */
}

/* 텍스트 스타일 최적화 */
.carousel__cell span {
    font-family: 'Cafe24Dangdanghae', sans-serif;
    font-size: 38px; /* 더 많은 글자를 담기 위해 크기 최적화 */
    color: #ff2a85;
    text-shadow: 
        1px 1px 0px #111,
        2px 2px 0px #111,
        3px 3px 4px rgba(0,0,0,0.9);
    -webkit-text-stroke: 1.2px #a4f522; 
    transform: scaleY(1.3); 
    display: inline-block;
}

/* 3D 자막 전용 고급 색상 클래스 추가 */
.text-green {
    color: #10b981 !important; /* 에메랄드 녹색 */
    -webkit-text-stroke: 1.2px #a4f522 !important;
    text-shadow: 1px 1px 0px #111, 2px 2px 0px #111, 3px 3px 10px rgba(16,185,129,0.8) !important;
}

.text-gold {
    color: #FFD700 !important; /* 황금색 (세월의 깊이와 가치) */
    -webkit-text-stroke: 1.2px #ff8c00 !important;
    text-shadow: 1px 1px 0px #111, 2px 2px 0px #111, 3px 3px 10px rgba(255,215,0,0.8) !important;
}

.text-silver {
    color: #f8fafc !important; /* 깨끗한 은백색 (다른 색상을 돋보이게 함) */
    -webkit-text-stroke: 1.2px #64748b !important;
    text-shadow: 1px 1px 0px #111, 2px 2px 0px #111, 3px 3px 8px rgba(0,0,0,0.9) !important;
}

/* 조사(의, 을, 는)를 특별히 작게 처리 */
.carousel__cell span.particle {
    font-size: 20px; /* 조사 글자크기 축소 */
    color: #ff85c0; 
    -webkit-text-stroke: 0.8px #a4f522;
}



/* 영역을 부드럽게 나눠주는 구분선 */
.divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.2), rgba(255,255,255,0));
    margin: 15px 0; /* 마진 더 축소 */
}

/* 고민 선택 영역 디자인 */
.selection-area {
    margin-bottom: 15px; /* 마진 더 축소 */
}

.selection-area label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #ddd;
}

/* 드롭다운 메뉴 디자인 */
select {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.3); /* 반투명한 검은색 배경 */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease; /* 부드러운 전환 효과 */
}

.selection-area select:focus {
    border-color: #a4f522; /* 포커스 시 테두리 색상 (네온 그린) */
    box-shadow: 0 0 8px rgba(164, 245, 34, 0.4);
}

/* 직접 입력용 텍스트 박스 */
#custom-worry-input {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 1rem;
    font-family: 'Cafe24Dangdanghae', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

#custom-worry-input:focus {
    border-color: #a4f522;
    box-shadow: 0 0 8px rgba(164, 245, 34, 0.4);
}

.text-silver {
    color: #e2e8f0;
    text-shadow: 0 0 5px rgba(226, 232, 240, 0.4);
}

.text-cyan {
    color: #00e5ff;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.8),
                 0 0 30px rgba(0, 229, 255, 0.4);
}

select option {
    background: #1a1a1a;
    color: white;
}

/* 룰렛 버튼 디자인 (아직 고민을 안 골랐을 때) */
#spin-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(45deg, #134f31, #2e8b57); /* 다크 그린 -> 씨그린 */
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* 버튼이 활성화되었을 때 호버(마우스 올림) 효과 */
#spin-btn:not([disabled]):hover {
    transform: translateY(-2px); /* 살짝 위로 떠오르는 효과 */
    box-shadow: 0 5px 15px rgba(46, 139, 87, 0.5); /* 녹색빛 그림자 발산 */
}

/* 버튼이 비활성화(고민 미선택) 상태일 때 */
#spin-btn[disabled] {
    background: rgba(255, 255, 255, 0.1);
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

/* 로딩 스피너 애니메이션 */
#loading-spinner {
    margin-top: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #2e8b57; /* 스피너의 윗부분을 녹색으로 변경 */
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite; /* 빙글빙글 돕니다 */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 결과창 숨기기/보이기용 클래스 */
.hidden {
    display: none !important;
}

/* 명언 결과 카드 디자인 */
#result-area {
    margin-top: 15px; /* 공간 절약을 위해 상단 여백 축소 */
    animation: fadeIn 1s ease-out;
}

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

.quote-card {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 15px; /* 세로 여백을 더 극단적으로 줄입니다 */
    border-radius: 15px;
    border-left: 5px solid #2e8b57;
    margin-bottom: 10px; /* 세로 여백 줄임 */
    width: 100%; /* 가로를 꽉 채워 글줄이 밑으로 넘어가지 않게 방지 (세로 길이 축소 효과) */
    max-width: 100%;
}

#philosopher-name {
    font-size: 1.1rem;
    color: #e8cbc0;
    margin-bottom: 5px; /* 세로 여백 최소화 */
}

#quote-text {
    font-size: 1.1rem;
    line-height: 1.3;
    font-style: italic;
    margin-bottom: 8px; /* 세로 여백 최소화 */
}

#quote-interpretation {
    font-size: 0.9rem;
    color: #b0b0b0;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px; /* 내부 여백 최소화 */
    border-radius: 8px;
    line-height: 1.3;
}

/* 유튜브 연계 버튼 (중요!) */
.youtube-btn {
    display: inline-block;
    padding: 8px 15px; /* 버튼 세로 길이도 줄여서 하단 여백 확보 */
    background-color: #10b981; /* 눈이 편안한 에메랄드 녹색 */
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.youtube-btn:hover {
    background-color: #059669; /* 마우스 올렸을 때 조금 더 짙은 녹색 */
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transform: scale(1.05); /* 살짝 커지는 효과 */
}

/* =========================================
   철학자 3D 입체 갤러리 (회전목마 스타일) 
   ========================================= */
.philosopher-gallery-3d {
    width: 100%;
    height: 300px; /* 반경이 훨씬 커졌으므로 잘림을 방지하기 위해 캔버스 세로폭을 대폭 확장 */
    margin-top: -70px; /* 더 커진 캔버스를 상단 남는 공간으로 바짝 밀어 올림 */
    perspective: 800px; /* 3D 원근감 렌즈 */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    /* 앞뒤 원근감을 더 자연스럽게 보여주기 위해 양끝 마스크 적용 (선택사항) */
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.gallery-carousel-3d {
    width: 0px; /* 정중앙 기준점 */
    height: 120px; /* 세로 길이 축소 */
    position: relative;
    transform-style: preserve-3d;
    animation: spin-gallery 120s infinite linear; /* 사진이 24장으로 늘어났으므로 120초로 더 우아하게 천천히 */
}

/* 마우스 올리면 회전 멈춤! */
.gallery-carousel-3d:hover {
    animation-play-state: paused;
}

@keyframes spin-gallery {
    /* 타원형 궤도를 위해 회전 반경(translateZ)을 더더욱 넓혔습니다(-342px) */
    0% { transform: translateZ(-342px) rotateX(-15deg) rotateY(0deg); }
    100% { transform: translateZ(-342px) rotateX(-15deg) rotateY(360deg); }
}

.gallery-card-3d {
    position: absolute;
    width: 90px; /* 카드가 24장으로 늘어났으므로 원주율에 맞춰 너비를 다시 줄임 */
    height: 110px; /* 너비에 맞게 세로 길이도 예쁜 비율로 줄임 */
    left: -45px; /* 폭의 절반(-45px)으로 이동하여 정중앙 맞춤 */
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* 이름을 맨 아래로 */
    text-decoration: none;
    background: #000;
    padding: 0; /* 테두리 여백 제거 (간격 없애기) */
    border: none;
    /* 뒷면이 보이게 할지 말지 결정. 보이게 하면 원을 돌아갈 때 뒷모습(좌우반전)이 보입니다! */
    backface-visibility: visible; 
    transition: box-shadow 0.3s ease, filter 0.3s ease;
}

/* 3D 요소는 transform(이동)을 쓰면 좌표가 꼬이므로, 그림자만 빛나게 합니다 */
.gallery-card-3d:hover {
    box-shadow: inset 0 0 40px rgba(46, 139, 87, 0.8); /* 안쪽으로 빛이 뿜어져 나오는 효과 */
    z-index: 10;
}

.gallery-card-3d img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* 여백 없이 꽉 채웁니다 */
    height: 100%; /* 여백 없이 꽉 채웁니다 */
    object-fit: cover;
    border-radius: 4px; /* 살짝 둥글게 복구 (아까 모양으로) */
    filter: sepia(0.2) contrast(1.1); /* 옛날 초상화 느낌 유지 */
    z-index: 1;
}

/* 이름 칸의 크기를 극단적으로 줄이고 텍스트 배경을 제거합니다 */
.gallery-card-3d .name-ko {
    position: relative;
    z-index: 2;
    font-size: 0.7rem; /* 글자 크기 더 축소 */
    font-weight: 700;
    color: #fff;
    background: transparent; /* 뒷배경 제거 */
    padding: 0;
    margin-bottom: 6px; /* 아래쪽 여백 조금 축소 */
    text-align: center;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 5px rgba(0,0,0,0.8); /* 배경이 없어도 글씨가 또렷하게 보이도록 그림자 강화 */
}

@-webkit-keyframes sweep-scroll {
    0% { -webkit-transform: translateX(100vw) rotateX(25deg); transform: translateX(100vw) rotateX(25deg); }
    100% { -webkit-transform: translateX(-100vw) rotateX(25deg); transform: translateX(-100vw) rotateX(25deg); } /* 간격 축소 */
}

@keyframes sweep-scroll {
    0% { transform: translateX(100vw) rotateX(25deg); }
    100% { transform: translateX(-100vw) rotateX(25deg); } /* 간격 축소 */
}

@-webkit-keyframes glide-title {
    0% { -webkit-transform: translateX(-10vw); transform: translateX(-10vw); }
    50% { -webkit-transform: translateX(10vw); transform: translateX(10vw); }
    100% { -webkit-transform: translateX(-10vw); transform: translateX(-10vw); }
}

@keyframes glide-title {
    0% { -webkit-transform: translateX(-10vw); transform: translateX(-10vw); }
    50% { -webkit-transform: translateX(10vw); transform: translateX(10vw); }
    100% { -webkit-transform: translateX(-10vw); transform: translateX(-10vw); }
}

@-webkit-keyframes wave-bob {
    0%, 100% { -webkit-transform: translateY(0) rotateZ(0deg); transform: translateY(0) rotateZ(0deg); }
    50% { -webkit-transform: translateY(-15px) rotateZ(-1deg); transform: translateY(-15px) rotateZ(-1deg); }
}

@keyframes wave-bob {
    0%, 100% { transform: translateY(0) rotateZ(0deg); }
    50% { transform: translateY(-15px) rotateZ(-1deg); }
}

/* =========================================================
   철학자 갤러리 모달 (팝업) 스타일
========================================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: linear-gradient(145deg, #1e1e30, #2a2a40);
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
    color: white;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 30px;
    color: #ff2a85;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-close-btn:hover {
    transform: scale(1.2);
}

#modal-name {
    font-family: 'Cafe24Dangdanghae', sans-serif;
    color: #a4f522;
    font-size: 2rem;
    margin-bottom: 20px;
}

#modal-quote {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 20px;
    font-style: italic;
    color: #f1f5f9;
}

#modal-advice {
    font-size: 0.95rem;
    color: #e8cbc0;
    line-height: 1.5;
}

/* ====================================================
   유튜브 비디오 내장(임베드) 모달 디자인
==================================================== */
.video-modal-content {
    background: rgba(15, 23, 42, 0.95);
    width: 95%;
    max-width: 800px;
    padding: 35px 15px 15px 15px;
    border-radius: 15px;
    position: relative;
    border: 2px solid #a4f522;
    box-shadow: 0 0 25px rgba(164, 245, 34, 0.5);
}

.iframe-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 비율 (유튜브 황금비율) */
    height: 0;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}
