/* 대화창 */
.mood-group {
    width: 250px;
}

@media (min-width: 1000px) {
    .mood-group {
        width: 610px;
    }

    .mood-title {
        font-size: 24px;
    }

}

.chat-window {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: 3px 3px 10px 0 var(--base-50);
    position: relative;
    width: 99%;
    height: 300px;
    background-color: #fff2;
    backdrop-filter: blur(3px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 1000px 이상 환경에서 가로 340px로 제한 */
@media (min-width: 1000px) {
    .chat-window {
        width: 340px;
    }
}

/* 채팅 헤더 스타일 */
.chat-header {
    padding: 10px 15px;
    background: linear-gradient(to right, var(--base-50), var(--point-50));
    font-weight: bold;
    font-size: 10px;
    color: #333;
    border-bottom: none;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
}

/* 제목을 감싸는 span */
.header-title {
    color: #fff;
    font-family: "Hahmlet", serif;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}


.right-header-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* 각 메시지를 묶는 컨테이너 */
.message-entry {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 5px
}

.message-entry.right {
    flex-direction: row-reverse;
}

.speaker-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 70px;
}

.speaker-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.speaker-name {
    font-weight: 600;
    font-size: 12px;
    margin-top: 5px;
    color: white;
    padding: 3px 12px;
    border-radius: 15px;
    white-space: nowrap;
}

.speaker-blue .speaker-name {
    background-color: var(--point);
}

.speaker-brown .speaker-name {
    background-color: #ded3bf;
}

.chat-bubble {
    backdrop-filter: blur(5px);
    border: none;
    font-family: "Hahmlet", serif;
    font-size: 14px;
    padding: 10px 20px;
    color: black;
    width: auto;
    display: inline-block;
    max-width: calc(100% - 80px);
}

.chat-bubble p {
    margin: 0;
}

.left .chat-bubble {
    background-color: var(--point-80);
    border-radius: 0px 20px 20px 20px;
    border: solid 1px var(--point);
    box-shadow: 3px 3px 10px 0 var(--point-50);
}

.right .chat-bubble {
    background-color: var(--base-80);
    border-radius: 20px 0px 20px 20px;
    border: solid 1px var(--base);
    box-shadow: 3px 3px 10px 0 var(--base-50);
}

/* --- 헤더 아이콘 버튼 스타일 --- */
.header-icon-button {
    position: relative;
    font-size: 14px;
    background-color: var(--base);
    border-radius: .375rem;
    margin: 0;
    box-shadow: none;
    color: #fff;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease-in-out overflow: hidden;
}

/* --- 갤러리 모달 및 아이템 스타일 --- */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;

    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.gallery-content {
    background-color: white;
    padding: 20px 20px;
    border-radius: 8px;
    height: 445px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 3px 3px 10px 0 var(--base-50);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
}

.gallery-content::-webkit-scrollbar {
    display: none;
}

.gallery-content {
    width: calc((4 * 50px) + (3 * 10px) + (2 * 10px) + 1px);
}

@media (min-width: 1000px) {
    .gallery-content {
        width: calc((10 * 50px) + (9 * 10px) + (2 * 10px) + 1px);
    }
}

.mood-group {
    flex-shrink: 0;
    height: auto;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: 20px;
    box-sizing: border-box;
    margin-bottom: 0;
    position: relative;/
}

.mood-group:last-child {
    padding-bottom: 0;
}

.mood-group-header {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--base);
    position: relative;
    padding-left: 40px;
    padding-right: 40px;
    box-sizing: border-box;
}

.mood-title {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin: 0;
    padding: 0px 20px;
    border-bottom: none;
}

.mood-group-item-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.0);
    color: #3f3f46;
    border: none;
    box-shadow: none;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.mood-group-item-nav-btn:hover {
    color: #000;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
}

/* 소대화 아이템들을 담는 컨테이너 */
.mood-items-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding-bottom: 10px;

    -ms-overflow-style: none;
    scrollbar-width: none;
}

.mood-items-container::-webkit-scrollbar {
    display: none;
}

.gallery-item {
    width: 50px;
    height: 50px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: left;
    font-size: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    overflow: hidden;
    position: relative;
    color: #3f3f46;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    scroll-snap-align: start;
}

/* gallery-item 호버 시 시작 캐릭터에 따른 배경색 변경 */
.gallery-item.start-blue:hover {
    background-color: var(--point-80);
    border: solid 1px var(--point);
    box-shadow: 3px 3px 10px 0 var(--point-50);
}

.gallery-item.start-brown:hover {
    background-color: var(--base-80);
    border: solid 1px var(--base);
    box-shadow: 3px 3px 10px 0 var(--base-50);
}

.hidden {
    display: none;
}

/* --- 갤러리 아이템 텍스트 애니메이션 --- */
.gallery-item .animated-text-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    padding: 5px;
    box-sizing: border-box;
}

.gallery-item .animated-text-track {
    white-space: nowrap;
    will-change: transform;
    display: inline-block;
    animation: marquee 5s linear infinite;
    animation-play-state: paused;
    font-size: inherit;
    line-height: 1;
    color: inherit;
}

.animated-text-content {
    margin-right: 15px;
}

/* @keyframes marquee 정의 */
@keyframes marquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* 마우스 호버 시 애니메이션 재생 */
.gallery-item:hover .animated-text-track {
    animation-play-state: running;
}

/* 각 mood-group 내의 아이템 탐색 버튼 (대제목 옆 위치) */
.mood-group-item-nav-btn {
    border-radius: 50%;
    position: relative;
    z-index: 10;
    background-color: none;
    color: var(--base);
    border: none;
    width: 40px;
    height: 40px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.mood-group-item-nav-btn.left-btn {}

.mood-group-item-nav-btn.right-btn {}

.mood-group-item-nav-btn:hover {
    color: var(--point);
    background-color: var(--base);
    border-radius: 50%;
}

/*랜덤 이미지*/
.flip-container {
    width: 100%;
    aspect-ratio: 500 / 200;
    position: relative;
}

.flipper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform-origin: center center;
    transition: transform 1s ease-in-out;
    transform: rotateY(0deg) rotate(5deg);
}

.front,
.back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    overflow: hidden;
    filter: drop-shadow(3px 0px #3355ff) drop-shadow(0px 3px #3355ff) drop-shadow(-3px 0px #3355ff) drop-shadow(0px -3px #3355ff) drop-shadow(5px 5px 8px var(--point-50));
}

.back {
    transform: rotateY(180deg);
}

.inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.inner img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    position: absolute;
    display: block;
    object-fit: cover;
}

.credit-box {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    pointer-events: none;
    font-family: 'Hahmlet';
    backface-visibility: hidden;
}