@charset "utf-8";

/* 1. 기본 설정 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #1a1a1a;
    display: flex; justify-content: center; align-items: center;
    height: 100vh; 
    height: 100dvh; 
    overflow: hidden;
}

/* 2. 게임 화면 프레임 (PC 기준) */
#game-container {
    position: relative; width: 1000px; height: 650px;
    background-color: #000; box-shadow: 0 0 30px rgba(0,0,0,0.8);
    overflow: hidden; border-radius: 10px;
}

/* 3. 레이어 정의 */
#background-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    z-index: 1; transition: background-image 0.3s ease-in-out;
}

#character-layer {
    position: absolute; 
    bottom: 0; left: 50%;
    transform: translateX(-50%); 
    height: 75%; 
    z-index: 5; pointer-events: none;
    display: flex; justify-content: center; align-items: flex-end;
}
#npc-img {
    height: 100%; width: auto; display: block;
    filter: drop-shadow(0 0 15px rgba(0,0,0,0.5));
    transition: opacity 0.2s ease;
}

#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; pointer-events: none; 
}

/* 4. UI 요소 디자인 */
#prev-btn {
    position: absolute; 
    top: 30px; left: 25px; 
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff; border: 1px solid #aaa;
    padding: 8px 12px; border-radius: 5px;
    cursor: pointer; font-size: 0.9rem;
    pointer-events: auto; z-index: 100;
    transition: all 0.2s;
}
#prev-btn:hover { background-color: #ffd700; color: #000; border-color: #ffd700; }

#dialogue-box {
    position: absolute; 
    top: 90px; 
    left: 50%; transform: translateX(-50%); 
    width: 90%; min-height: 90px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px; padding: 15px 20px;
    color: white; pointer-events: auto;
    display: flex; flex-direction: column; justify-content: center;
    text-align: center; box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 20;
}
#speaker-name { display: none; }
#dialogue-text { font-size: 1.15rem; line-height: 1.5; word-break: keep-all; font-weight: 500; }

#choices-container {
    position: absolute; 
    bottom: 30px; left: 50%;
    transform: translateX(-50%); 
    width: 90%;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: auto;
    z-index: 30; 
    max-height: 50%; overflow-y: auto; padding-bottom: 5px;
}
#choices-container::-webkit-scrollbar { width: 0; }

.choice-btn {
    background: linear-gradient(to bottom, #fff, #f0f0f0);
    border: 1px solid #bbb; 
    padding: 10px 15px;
    font-size: 0.95rem; font-weight: bold; color: #222;
    border-radius: 50px; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: all 0.1s; text-align: center; opacity: 0.98;
    -webkit-tap-highlight-color: transparent; 
    flex-shrink: 0;
}
@media (hover: hover) {
    .choice-btn:hover { background: #ffd700; border-color: #ffaa00; transform: translateY(-2px); color: #000; }
}
.choice-btn:active { background: #ffd700; border-color: #ffaa00; transform: scale(0.98); color: #000; }

/* 5. 시작/종료 화면 */
#start-screen, #result-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #202020;
    z-index: 100;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center; color: white;
}

.game-title { 
    font-size: 2.8rem; 
    margin-bottom: 40px; 
    color: #ffd700; 
    text-align: center; 
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* ★ 입력창 디자인 수정 (통일감 강조) ★ */
input[type="text"] { 
    background-color: #333;
    border: 1px solid #444;
    color: #ffd700;
    padding: 15px; 
    font-size: 1.1rem; 
    margin-bottom: 12px; 
    text-align: center; 
    width: 320px; /* PC 기준 너비 고정 */
    max-width: 85%; /* 모바일에서 화면을 벗어나지 않도록 설정 */
    border-radius: 12px; 
    transition: all 0.3s;
    outline: none;
    display: block; /* 한 줄에 하나씩 */
}

input[type="text"]::placeholder {
    color: #888;
}

input[type="text"]:focus {
    border-color: #ffd700;
    background-color: #3d3d3d;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.action-btn { 
    padding: 15px 50px; 
    font-size: 1.2rem; 
    background: #ffd700; 
    color: #000; 
    border: none; 
    border-radius: 50px; 
    cursor: pointer; 
    font-weight: bold; 
    margin-top: 10px;
    transition: all 0.2s;
    width: 320px; /* 입력창과 동일한 너비로 맞춰주면 더 예쁩니다 */
    max-width: 85%;
}

.action-btn:hover {
    background: #ffaa00;
    transform: scale(1.05);
}

/* 6. 오답 노트 및 결과 (디자인 보강 버전) */
#review-box { 
    width: 85%; 
    max-height: 350px; /* 가독성을 위해 높이를 살짝 키움 */
    overflow-y: auto; 
    background-color: rgba(0, 0, 0, 0.3); /* 배경을 조금 더 어둡게 하여 글자 집중도 향상 */
    border-radius: 12px; 
    padding: 20px; 
    margin: 20px 0; 
    text-align: left; 
    border: 1px solid #444;

    /* [추가] 표준 스크롤바 스타일 (파이어폭스 등) */
    scrollbar-width: thin;
    scrollbar-color: #ffd700 #333;
}

/* [추가] 웹킷 기반 브라우저(크롬, 사파리, 웨일) 스크롤바 디자인 */
#review-box::-webkit-scrollbar {
    width: 6px;
}
#review-box::-webkit-scrollbar-thumb {
    background-color: #ffd700; /* 스크롤바를 포인트 컬러인 노란색으로 */
    border-radius: 10px;
}
#review-box::-webkit-scrollbar-track {
    background-color: #222;
}

#review-box h3 { 
    color: #ffd700; 
    text-align: center; 
    margin-bottom: 20px; 
    padding-bottom: 10px; 
    border-bottom: 1px solid #444; 
}

/* [수정] 오답 항목을 카드 형태로 변경 */
.review-item { 
    margin-bottom: 25px; 
    background: rgba(255, 255, 255, 0.05); /* 각 항목에 은은한 배경색 추가 */
    padding: 15px; 
    border-radius: 10px; 
    transition: 0.2s;
}
.review-item:hover {
    background: rgba(255, 255, 255, 0.08); /* 마우스 올렸을 때 살짝 밝아짐 */
}

.review-q { font-weight: bold; color: #eee; margin-bottom: 8px; font-size: 0.95rem; }
.review-choice { color: #ff8888; font-size: 0.9rem; margin-bottom: 5px; }
.review-feedback { color: #ffd700; font-size: 0.9rem; margin-top: 8px; line-height: 1.5; }

/* 7. 인트로 화면 */
#intro-screen {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; background-color: #000;
    z-index: 200; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px;
}
.intro-content p { font-family: 'Nanum Myeongjo', serif; font-size: 1.3rem; color: #ddd; margin-bottom: 25px; line-height: 1.6; }
.intro-btn { margin-top: 30px; padding: 12px 30px; font-size: 1.1rem; background: transparent; border: 1px solid #fff; color: #fff; border-radius: 5px; cursor: pointer; font-family: 'Noto Sans KR', sans-serif; transition: 0.3s; }
.intro-btn:hover { background: #fff; color: #000; }
.fade-in-text { opacity: 0; animation: fadeIn 1.5s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.t1 { animation-delay: 0.5s; } .t2 { animation-delay: 2.0s; } .t3 { animation-delay: 5.0s; } .t4 { animation-delay: 7.5s; } .t5 { animation-delay: 9.5s; }

/* ============ [모바일 반응형 최적화] ============ */
@media (max-width: 768px) {
    #game-container { 
        width: 100vw; 
        height: 100vh; height: 100dvh; 
        border-radius: 0; box-shadow: none; 
    }
    #background-layer { 
        background-size: cover; 
        background-repeat: no-repeat; 
        background-position: center bottom;
    }
    
    #prev-btn { 
        top: 15px; 
        left: 20px; width: auto; 
        padding: 6px 12px; font-size: 0.85rem; 
        z-index: 101;
    }
    #dialogue-box { 
        top: 60px; 
        width: 92%; padding: 12px; min-height: 60px; 
        z-index: 20;
    }
    #dialogue-text { font-size: 1rem; line-height: 1.4; font-weight: normal; }

    #character-layer { 
        height: 50%; width: 100%;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%);
        bottom: auto; 
        z-index: 5; 
        align-items: center; 
    }
    #npc-img {
        max-height: 100%;
        margin-top: 30px;
    }

    #choices-container { 
        bottom: 20px; width: 95%; gap: 8px; 
        max-height: 35%; 
        overflow-y: auto; 
        z-index: 50; 
    }
    
    .choice-btn { 
        padding: 12px 10px; 
        font-size: 0.95rem; 
        white-space: normal; 
        background: rgba(255, 255, 255, 0.95); 
    }
    
    .game-title { font-size: 1.8rem; margin-bottom: 20px; }
    /* 모바일에서도 너비가 어긋나지 않도록 수정 */
    input[type="text"], .action-btn { width: 85% !important; }
    #review-box { width: 90%; max-height: 250px; }
}