/* idol.css */
.idol-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1rem;
    padding: 1.5rem 1rem 0.8rem;
    /* 하단 여백을 1.5rem에서 0.8rem으로 축소 */
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.idol-grid::-webkit-scrollbar {
    display: none;
}

.idol-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.idol-icon-wrapper {
    position: relative;
    display: inline-block;
}

.idol-icon {
    width: 80px;
    height: 110px;
    border-radius: 12px;
    background: #fff;
    padding: 3px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: cover;
}

.fav-star-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.4;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transform: scale(0.8);
}

.fav-star-btn.active {
    opacity: 1;
    transform: scale(1.1);
}

.fav-star-svg {
    width: 24px;
    height: 24px;
    color: #ccc;
    /* 비활성화 시 회색 */
    transition: color 0.3s;
}

.fav-star-btn.active .fav-star-svg {
    color: var(--fav-color, #fbc02d);
    /* 활성화 시 아이돌 고유색 (기전 노란색 유지 가능) */
}

.fav-star-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.idol-icon:hover {
    transform: scale(1.05);
}

.idol-icon.selected {
    border-width: 2px;
    border-style: solid;
    /* [수정] JS에서 동적으로 색상 설정 */
    transform: translateY(-5px) scale(1.05);
    z-index: 5;
}


/* Idol Video List Styles */
.idol-video-container-wrapper {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0 1rem 0.4rem;
    /* 하단 여백 축소 */
    display: none;
    position: relative;
}

/* 중간 고유색 선: 짧게 중앙 정렬 */
.idol-video-container-wrapper::after {
    content: '';
    display: block;
    width: 90%;
    height: 1px;
    margin: 0.5rem auto 0;
    background-color: var(--idol-border-color, transparent);
}

.idol-video-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1rem;
    padding: 0.8rem 0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
    max-width: 1000px;
    margin: 0 auto;
}

.idol-video-list::-webkit-scrollbar {
    display: none;
}

.idol-video-item {
    flex: 0 0 auto;
    width: 180px;
    /* 크기를 살짝 조절 */
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
    /* 카드 배경 복구 */
    border-radius: 12px;
    overflow: hidden;
    padding-bottom: 0;
    /* 하단 여백 제거 */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.idol-video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.video-thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background: #000;
}

.video-thumb {
    width: 100%;
    height: auto;
    display: block;
    /* 하단 미세 공백 제거 */
    transition: transform 0.3s;
}

.video-play-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.idol-video-item:hover .video-play-overlay {
    transform: scale(1.1);
}

.video-play-icon {
    width: 16px;
    height: auto;
}



/* PSSR Display Styles */
.pssr-container {
    margin-top: 1rem;
    width: 100%;
    padding: 0 1rem 5rem;
}

.pssr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    /* 최소 너비 220px로 확대 */
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.pssr-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.pssr-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 200%;
    overflow: hidden;
    background: #eee;
    transition: background-color 0.3s ease;
    /* 배경색 전환 부드럽게 */
}

.pssr-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translateX(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
    opacity: 1;
}

/* 슬라이드 아웃 (왼쪽으로 사라짐) */
.pssr-img.slide-out {
    transform: translateX(-100%);
    opacity: 0;
}

/* 슬라이드 인 준비 (오른쪽 대기) */
.pssr-img.slide-prepare {
    transition: none;
    transform: translateX(100%);
    opacity: 0;
}

.pssr-info {
    padding: 10px;
    background: #fff;
    /* JS에서 퍼스널 컬러로 덮어씀 */
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    transition: background-color 0.3s;
    /* [수정] 늘어난 칸 안에서 내용이 수직 중앙에 오도록 함 */
    justify-content: center;
    min-height: 60px;
    /* 카드의 최소 높이 유지를 위해 필요 */
}

.pssr-name-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.pssr-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #333;
    line-height: 1.25;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
    text-align: left;
    word-break: keep-all;
    flex: 1;
}

.pssr-name.lang-ja {
    letter-spacing: -0.06em;
    /* 초고밀도 자간 축소 */
}

.pssr-youtube-link {
    display: flex;
    align-items: center;
    opacity: 0.8;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.pssr-youtube-link:hover {
    transform: scale(1.1);
    opacity: 1;
}

.pssr-youtube-icon {
    width: 20px;
    height: auto;
    object-fit: contain;
}

.pssr-rarity-icon {
    height: 18px;
    width: auto;
    object-fit: contain;
    align-self: flex-start;
}

.pssr-plan-icon {
    position: absolute;
    top: -15px;
    /* 정보창 경계선 위로 원복 */
    right: 44px;
    /* osusume-icon(30px) + 간격(4px) + 우측 여백(10px) */
    width: 30px;
    height: 30px;
    z-index: 10;
}

.pssr-osusume-icon {
    position: absolute;
    top: -15px;
    right: 10px;
    width: 30px;
    height: 30px;
    z-index: 10;
}

@media (max-width: 768px) {
    .pssr-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .pssr-img-wrapper {
        padding-top: 200%;
    }

    .pssr-name {
        font-size: 0.65rem;
    }

    .pssr-plan-icon {
        width: 24px;
        height: 24px;
        top: -12px;
        right: 36px;
        /* osusume-icon(24px) + 간격(4px) + 우측 여백(8px) */
    }

    .pssr-osusume-icon {
        width: 24px;
        height: 24px;
        top: -12px;
        right: 8px;
    }

    .pssr-rarity-icon {
        height: 14px;
    }
}

/* calc.css */
.calc-menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2rem;
    padding-top: 4rem;
}

.calc-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.video-thumb-container,
.video-thumb-wrapper {
    position: relative;
    /* 날짜 위치 기준점 */
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.video-date {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    pointer-events: none;
    /* 클릭 방해 금지 */
    z-index: 5;
}

.video-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    /* 다시 여유 있는 높이로 */
    gap: 8px;
    /* height 제거: 세로 높이 보존 */
}

.video-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    line-height: 1;
    text-align: left;
    white-space: nowrap;
    overflow: visible;
    flex: 1;
    min-width: 0;
    /* 글자가 길어져도 아이콘을 밀어내지 않게 필수 추가 */
    transform-origin: left center;
}

/* 데스크톱 비율 유지 축소 */
.video-title.len-long {
    transform: scale(0.95);
}

.video-title.len-vlong {
    transform: scale(0.9);
    letter-spacing: -0.02em;
}

.video-title.len-extreme {
    transform: scale(0.7);
    letter-spacing: -0.04em;
}

.video-title.len-ultra {
    transform: scale(0.63);
    letter-spacing: -0.05em;
}

/* 일본어 모드 시 자간 추가 축소 */
.video-title.lang-ja {
    letter-spacing: -0.02em;
}

.video-title.lang-ja.len-vlong {
    letter-spacing: -0.04em;
}

.video-title.lang-ja.len-extreme {
    letter-spacing: -0.07em;
}

.video-title.lang-ja.len-ultra {
    transform: scale(0.6);
    letter-spacing: -0.08em;
}

.video-link-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    /* 절대 밀려나지 않게 고정 */
    display: block;
    opacity: 0.8;
    transition: transform 0.2s;
    background: transparent !important;
}

.idol-video-item:hover .video-link-icon {
    transform: scale(1.1);
    opacity: 1;
}

/* 모바일 대응 (최우선 적용을 위해 하단 배치) */
@media (max-width: 768px) {
    .idol-icon {
        width: 65px;
        height: 90px;
        border-radius: 8px;
        /* 둥글기 축소 */
    }

    .fav-star-btn {
        width: 22px;
        height: 22px;
        top: 1px;
        right: 1px;
    }

    .fav-star-svg {
        width: 18px;
        height: 18px;
    }

    /* 영상 리스트 모바일 축소 */
    .idol-video-item {
        width: 100px;
        border-radius: 8px;
        /* 둥글기 축소 */
    }

    .video-info {
        /* height 제거: 세로 높이 보존 */
        padding: 4px 7px;
        gap: 2px;
        margin-bottom: 2px;
    }

    .video-title {
        font-size: 0.5rem;
        font-weight: 600;
        transform-origin: left center;
        /* translateY 제거: 칸 높이가 생겼으므로 억지로 올릴 필요 없음 */
    }

    /* 모바일 비율 유지 축소 (요청 수치 적용) */
    .video-title.len-long {
        transform: scale(0.94);
    }

    .video-title.len-vlong {
        transform: scale(0.9);
        letter-spacing: -0.03em;
    }

    .video-title.len-extreme {
        transform: scale(0.68);
        letter-spacing: -0.05em;
    }

    .video-title.len-ultra {
        transform: scale(0.6);
        letter-spacing: -0.06em;
    }

    /* 일본어 모바일 자간 추가 축소 */
    .video-title.lang-ja {
        letter-spacing: -0.03em;
    }

    .video-title.lang-ja.len-vlong {
        letter-spacing: -0.05em;
    }

    .video-title.lang-ja.len-extreme {
        letter-spacing: -0.08em;
    }

    .video-title.lang-ja.len-ultra {
        transform: scale(0.57);
        letter-spacing: -0.1em;
    }

    .video-link-icon {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
        /* 모바일에서도 고정 */
    }

    .video-date {
        font-size: 0.5rem;
        padding: 1px 2px;
        bottom: 2px;
        right: 2px;
    }
}

/* Bottom Menu Logo Text (PC only) */
.menu-logo-text {
    display: none;
    position: absolute;
    left: 1.5rem;
    font-size: 0.75rem;
    font-weight: 900;
    color: #fff;
    background: var(--idol-theme-color, var(--primary-color));
    padding: 3px 10px;
    border-radius: 0;
    letter-spacing: 0.05em;
    white-space: nowrap;
    opacity: 1;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

@media (min-width: 769px) {
    .button-group.horizontal {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .menu-logo-text {
        display: block;
    }
}