/* ============================================================================
   Gallery Free Talk - VN 스타일 프리토킹 오버레이
   ============================================================================
   게임 내 프리토킹과 동일한 UI. 배경 + 캐릭터 + 대사창 + 입력창.
   대사창·입력창·이미지업로드 등은 style.css의 게임 ID 스타일을 그대로 재활용.
   이 파일에는 갤러리 오버레이 전용 레이아웃만 정의.
   ============================================================================ */

/* ── 프리토킹 버튼 (캐릭터 모달 내부) ── */

.freetalk-btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 15px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--c-accent-strong);
    color: #fff;
    box-shadow: 0 4px 15px rgba(232, 138, 160, 0.4);
    font-family: 'Pretendard', sans-serif;
}

.freetalk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 138, 160, 0.5);
}

.freetalk-btn:active {
    transform: translateY(0);
}

.freetalk-btn.locked {
    background: rgba(80, 80, 80, 0.5);
    color: #888;
    box-shadow: none;
    cursor: pointer;
}

.freetalk-btn.locked:hover {
    background: rgba(100, 100, 100, 0.5);
    color: #aaa;
}

/* ── 풀스크린 오버레이 ── */

.gallery-freetalk-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 300;
    overflow: hidden;
    background: #000;
}

.gallery-freetalk-overlay.active {
    display: block;
}

/* ── 배경 이미지 ── */

.gft-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* ── 캐릭터 스프라이트 (화면 중앙 하단) ── */

.gft-character {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    z-index: 1;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.gft-character img {
    height: 100%;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

/* ── UI 레이어 (하단 고정) ── */

.gft-ui-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    padding: 0 20px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    transition: transform 0.18s ease;
    will-change: transform;
}

/* ── style.css 오버라이드 (오버레이 컨텍스트에서 필요한 조정) ── */

/* 대사창: 오버레이 안에서 pointer-events 활성화 */
.gallery-freetalk-overlay #dialogue-box {
    pointer-events: auto;
    margin-bottom: 0;
}

/* 캐릭터별 갤러리 프리토킹 현재 호감도 */
.gft-affinity-display {
    position: absolute;
    top: 0;
    right: 20px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 64px;
    padding: 5px 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(20, 16, 24, 0.88);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    pointer-events: none;
    z-index: 2;
}

.gft-affinity-display.positive {
    color: #ff9eb8;
}

.gft-affinity-display.negative {
    color: #91a9ff;
}

.gft-affinity-display.neutral {
    color: #f1edf2;
}

.gft-affinity-icon {
    font-size: 1.05em;
}

.gft-affinity-value {
    min-width: 2.7ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* 입력 컨테이너: 오버레이 안에서 pointer-events 활성화 + 여백 제거 */
.gallery-freetalk-overlay #chat-container {
    display: block;
    pointer-events: auto;
    margin-bottom: 0;
}

/* 채팅 입력란 placeholder */
.gallery-freetalk-overlay #chat-input::placeholder {
    color: #888;
}

/* 지문 (액션) 스타일 — 제타식 단락형 */
.gft-action {
    display: block;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 14px;
    border-radius: 6px;
    margin: 0.75rem 0;
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.85;
    font-style: italic;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: pre-line;
}

/* 대사 span도 제타식 줄간격 */
.gallery-freetalk-overlay #message > span:not(.gft-action),
.gallery-freetalk-overlay #message > .gft-text {
    display: block;
    margin: 0.45rem 0;
    white-space: pre-line;
    line-height: 1.75;
}

/* 대사창 내 채팅 이미지 */
.gft-chat-image {
    max-width: 120px;
    max-height: 120px;
    border-radius: 6px;
    margin-top: 8px;
    object-fit: contain;
}

/* ── 닫기 버튼 (갤러리 전용) ── */

.gft-close-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--c-accent);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    pointer-events: auto;
    flex-shrink: 0;
}

.gft-close-btn:hover {
    background: var(--c-accent);
}

/* 닫기 버튼을 입력창 옆에 배치 */
.gft-bottom-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.gft-bottom-row #chat-container {
    flex: 1;
    min-width: 0;
}

/* ── 모바일 반응형 ── */

@media (max-width: 768px) {
    .gft-character {
        height: 90%;
    }

    .gft-ui-layer {
        padding: 0 12px 12px;
    }

    .gallery-freetalk-overlay #dialogue-box {
        min-height: 100px;
        padding: 16px;
    }

    .gallery-freetalk-overlay #message {
        font-size: 1rem;
    }

    .gallery-freetalk-overlay #name-tag {
        font-size: 0.95rem;
        padding: 4px 12px;
    }

    .gft-affinity-display {
        right: 12px;
        padding: 4px 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gft-character {
        height: 100%;
        bottom: -10%;
    }

    .gallery-freetalk-overlay #dialogue-box {
        min-height: 80px;
        padding: 14px;
    }

    .gallery-freetalk-overlay #message {
        font-size: 0.95rem;
    }

    .gft-affinity-display {
        right: 10px;
        gap: 4px;
        min-width: 58px;
        padding: 4px 8px;
        font-size: 0.85rem;
    }

    .gallery-freetalk-overlay #chat-input {
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .gft-close-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}
