/* --- 1. 폰트 파일 등록하기 --- */
@font-face {
    font-family: 'TitleFont'; 
    src: url('온글잎 수야.ttf') format('truetype'); 
}

@font-face {
    font-family: 'DialogueFont'; 
    src: url('온글잎 수야.ttf') format('truetype'); 
}

body {
    margin: 0;
    background: #ffeef2;
    font-family: 'TitleFont', 'Malgun Gothic', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 800px;
    height: 640px; 
    position: relative;
    border: none;        
    border-radius: 0;    
    box-shadow: none;    
    overflow: hidden;
    background-color: #ffeef2;
}

.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* 🌐 우측 상단 고정 언어 전환 버튼 스타일 */
.corner-lang-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid #ffb6c1;
    border-radius: 15px;
    padding: 5px 12px;
    cursor: pointer;
    font-family: 'DialogueFont', sans-serif;
    font-weight: bold;
    font-size: 14px;
    color: #744a4a;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.corner-lang-btn:hover {
    background: #ffffff;
    transform: scale(1.05);
}

#title-screen {
    background-image: url('title-bg.jpg'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 5;
}

#title-logo {
    width: 440px; 
    height: auto;
    margin-bottom: 20px; 
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
    user-select: none;
}

/* --- 공통 이미지 + 텍스트 버튼 스타일 --- */
.img-btn {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease-in-out;
}

.btn-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    color: #744a4a;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.95), 0 0 2px rgba(255, 255, 255, 1);
    font-family: 'DialogueFont', sans-serif;
    white-space: nowrap;
    pointer-events: none;
}

.small-label {
    font-size: 17px;
}

/* 시작 버튼 */
#start-btn {
    margin-top: 10px;
}

#start-btn img {
    width: 170px; 
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

#start-btn:hover {
    transform: scale(1.08);
}

/* --- 플레이 화면 및 배경 블러 레이어 --- */
#play-screen {
    background: none;
}

#play-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('play-bg.jpg'); 
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    transition: filter 0.3s ease;
}

#play-bg.blurred {
    filter: blur(3px) brightness(0.98);
    transform: scale(1.02);
}

#dialogue-box {
    position: absolute;
    bottom: 2.5%;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    aspect-ratio: 2156 / 729; 
    background-image: url('dialogue-bg.png'); 
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 10;
    cursor: pointer;
    opacity: 0.85; 
}

/* 📌 한국어 기준 기본 이름표 */
#speaker-name {
    position: absolute;
    top: 24%;     
    left: 18%;    
    font-weight: bold;
    color: #744a4a;
    font-size: 22px; 
    text-shadow: none;
    font-family: 'DialogueFont', sans-serif;
}

/* 📌 한국어 기준 기본 대사 본문 */
#dialogue-text {
    position: absolute;
    top: 52%;     
    left: 10%;    
    width: 80%;     
    color: #744a4a;
    font-size: 23px; 
    line-height: 1.5;
    text-shadow: none;
    font-family: 'DialogueFont', sans-serif;
}

/* 예 / 아니요 선택지 박스 */
#choice-box {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: row; 
    gap: 40px;           
    z-index: 20;
}

.choice-btn img {
    width: 145px; 
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

.choice-btn:hover {
    transform: scale(1.08);
}

#ingredient-stage {
    position: absolute;
    top: 36%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 20;
    width: 96%;
}

.stage-title-box {
    background-image: url('title-bg-box.png'); 
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    width: 340px;   
    padding: 12px 0; 
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
}

.stage-title-text {
    font-size: 21px;
    font-weight: bold;
    color: #744a4a;
    text-shadow: none;
    font-family: 'DialogueFont', sans-serif;
    transform: translateY(1px);
}

.ingredient-list {
    display: flex;
    gap: 12px; 
    justify-content: center;
    align-items: center;
}

.ing-img-btn {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease-in-out;
}

.ing-img-btn img {
    width: 110px; 
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.ing-label {
    position: absolute;
    top: 50%;         
    left: 58%;        
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: bold;
    color: #744a4a;   
    text-shadow: none;
    font-family: 'DialogueFont', sans-serif;
    white-space: nowrap;
    pointer-events: none; 
}

.ing-img-btn:hover {
    transform: scale(1.1); 
}

/* 처음으로 / 이전으로 돌아가기 버튼 */
#restart-btn, #back-btn {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
}

#restart-btn img, #back-btn img {
    width: 190px;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

#restart-btn:hover, #back-btn:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

/* =========================================
   🌐 [영어 모드 전용] PC 화면에서 영어일 때만 적용되는 스타일
   ========================================= */
#game-container.lang-en #dialogue-text {
    font-size: 20px; 
    top: 49%;
    left: 10%;
    line-height: 1.4;
}

#game-container.lang-en #speaker-name {
    font-size: 20px;
    top: 24%;
    left: 18%;
}

#game-container.lang-en .ing-label {
    font-size: 15px;
    top: 50%;
    left: 60%;
}


/* =========================================
   📱 [모바일] 850px 이하 화면 전용 세팅
   ========================================= */
@media screen and (max-width: 850px) {
    #game-container {
        width: 360px;
        height: 288px; 
        border: none;    
        border-radius: 0;
    }

    .corner-lang-btn {
        top: 8px;
        right: 8px;
        padding: 3px 8px;
        font-size: 10px;
        border-width: 1px;
    }

    #title-logo {
        width: 220px; 
        margin-bottom: 10px;
    }

    #start-btn img {
        width: 100px; 
    }

    .btn-label {
        font-size: 12px;
        text-shadow: none;
    }

    .small-label {
        font-size: 10px;
    }

    #speaker-name {
        font-size: 13px; 
        top: 22%;
        left: 18%;
        text-shadow: 0 0 1px rgba(255, 255, 255, 0.3);
    }

    #dialogue-text {
        font-size: 11px; 
        line-height: 1.35;
        top: 50%;
        left: 10%;
        width: 80%;
        text-shadow: 0 0 1px rgba(255, 255, 255, 0.25);
    }

    #choice-box {
        gap: 18px;
    }

    .choice-btn img {
        width: 95px; 
    }

    .stage-title-box {
        width: 190px;
        padding: 7px 0;
    }

    .stage-title-text {
        font-size: 13px; 
        text-shadow: none;
    }

    .ingredient-list {
        gap: 5px; 
    }

    .ing-img-btn img {
        width: 64px; 
    }

    .ing-label {
        font-size: 11px; 
        left: 62%; 
        text-shadow: none;
    }

    #restart-btn img, #back-btn img {
        width: 120px;
    }

    /* 🌐 [영어 모드 전용] 모바일에서 영어일 때만 적용되는 미세조정 */
    #game-container.lang-en #dialogue-text {
        font-size: 9.5px; 
        top: 49%;
        left: 10%;
    }
    #game-container.lang-en #speaker-name {
        font-size: 11px;
        top: 24%;
        left: 16%;
    }
    #game-container.lang-en .ing-label {
        font-size: 9.5px;
        top: 50%;
        left: 62%;
    }
}

/* =========================================
   📱 모바일 터치 하이라이트 및 흰색 깜빡임 완전 제거
   ========================================= */
* {
    -webkit-tap-highlight-color: transparent;
}

#game-container, .screen, #play-bg {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}