* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Pretendard', sans-serif;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1280px; /* 16:9 비율 권장 */
    margin: 0 auto;
    background-color: #222;
    overflow: hidden;
}

#background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #333;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
}

#character-layer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 110%; /* 데스크탑에서 캐릭터가 더 꽉 차 보이도록 확대 */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}

#character-img {
    max-height: 100%;
    object-fit: contain;
}

#ui-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    pointer-events: none;
}

#dialogue-box {
    position: relative;
    width: 100%;
    min-height: 150px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff69b4;
    border-radius: 10px;
    padding: 20px;
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    margin-bottom: 10px;
}

#name-tag {
    position: absolute;
    top: -25px;
    left: 20px;
    background: #ff69b4;
    padding: 5px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1rem;
}

#message {
    font-size: 1.2rem;
    line-height: 1.6;
    word-break: keep-all;
    white-space: pre-wrap;
}

#next-indicator {
    position: absolute;
    bottom: 10px;
    right: 20px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

#choice-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto;
}

.choice-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ff69b4;
    padding: 15px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.choice-btn:hover {
    background: #ff69b4;
    color: #fff;
}

/* 반응형 및 세로 모드 최적화 */
@media (orientation: portrait) {
    #character-layer {
        height: 70%; /* 세로 모드에서는 캐릭터를 조금 낮게 배치 */
        bottom: 10%;
    }

    #dialogue-box {
        min-height: 180px; /* 세로 모드에서 텍스트 가독성을 위해 높이 확보 */
        padding: 25px 20px;
    }

    #message {
        font-size: 1.1rem; /* 작은 화면 대응 */
    }

    #choice-container {
        width: 90%;
    }

    .choice-btn {
        padding: 12px;
        font-size: 1rem;
    }
}

/* 모바일 가로 모드 최적화 (화면 높이가 작을 때) */
@media (max-height: 500px) and (orientation: landscape) {
    #character-layer {
        height: 100%;
        bottom: -5%; /* 캐릭터가 너무 위로 올라오지 않게 조정 */
    }

    #dialogue-box {
        min-height: 100px;
        padding: 15px 20px;
        margin-bottom: 5px;
    }

    #name-tag {
        top: -20px;
        font-size: 0.9rem;
        padding: 3px 10px;
    }

    #message {
        font-size: 1rem;
        line-height: 1.4;
    }

    #choice-container {
        gap: 8px;
        width: 70%;
    }

    .choice-btn {
        padding: 8px;
        font-size: 0.9rem;
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}
