/* ===================================================================
   이 파일은 "구조 프로토타입"입니다.
   배경/캐릭터는 전부 색깔 블록 + 텍스트 라벨(placeholder)이며,
   실제 일러스트는 디자인팀(Figma) 산출물이 나오면 교체합니다.
   스타일가이드_피그마.md 확정되면 색상/폰트만 이 파일에서 치환하면 됩니다.
   =================================================================== */
* { box-sizing: border-box; }
body {
    margin: 0; font-family: "Pretendard", "Apple SD Gothic Neo", sans-serif;
    background: #000; color: #222;
}

/* 풀블리드: 16:9 레터박싱 프레임 제거, 뷰포트 전체(100vw x 100vh)를 채움.
   .screen들은 position:absolute; inset:0 이라 #game-root 크기만 바뀌면
   자동으로 꽉 차게 따라옴 (씬/엔딩/결과 화면은 손 안 대도 됨). */
#game-root {
    width: 100vw;
    height: 100vh;
    background: #000; position: relative; overflow: hidden;
}
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* 언어 전환 위젯 - #game-root 직속 자식이라 어떤 화면(.screen)이 떠 있든 항상 위에 보임.
   씬 화면은 배경이 실사 이미지라 밝기가 제각각이므로, 텍스트만 얹지 않고
   반투명 검은 배경(pill) + 블러를 깔아서 어떤 배경 위에서도 대비가 나오게 함. */
.etiquette-language-widget {
    position: absolute; top: 10px; left: 10px; z-index: 60;
    padding: 6px 12px;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    border-radius: 999px;
}
.etiquette-language-widget .language-area { gap: 8px; }
.etiquette-language-widget .language-button {
    color: rgba(255,255,255,.75);
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.etiquette-language-widget .language-button.active { color: #e0b568; }
.etiquette-language-widget .language-area span { color: rgba(255,255,255,.4); }

/* 씬 화면 오른쪽 위 아이콘 툴바 (이전 대화 / 대화창 끄기 / 메인으로) —
   언어 위젯이랑 같은 pill 톤으로 짝을 맞춤 */
.scene-toolbar {
    position: absolute; top: 10px; right: 10px; z-index: 60;
    display: flex; gap: 6px; padding: 6px;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    border-radius: 999px;
}
.toolbar-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: none; background: transparent;
    color: rgba(255,255,255,.75); cursor: pointer; text-decoration: none;
    transition: background .15s, color .15s;
}
.toolbar-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.toolbar-btn.active { background: rgba(201,154,75,.3); color: #e0b568; }
.toolbar-btn:disabled { opacity: .3; cursor: default; }
.toolbar-btn:disabled:hover { background: transparent; color: rgba(255,255,255,.75); }

/* ---------- 로딩 ---------- */
#screen-loading {
    justify-content: center; align-items: center; gap: 16px;
    background: linear-gradient(160deg, #3a2f28, #1c1712);
    color: #f3e9d8; text-align: center;
}
#screen-loading p { font-size: 14px; opacity: .75; margin: 0; }
#loading-bar-track {
    width: 220px; height: 6px; border-radius: 4px;
    background: rgba(255,255,255,.12); overflow: hidden;
}
#loading-bar-fill {
    width: 0%; height: 100%; background: #c99a4b; transition: width .15s ease-out;
}
#loading-percent { font-size: 13px; color: rgba(243,233,216,.6); }

/* ---------- 타이틀 ---------- */
#screen-title {
    align-items: center;
    background: linear-gradient(160deg, #3a2f28, #1c1712);
    color: #f3e9d8; text-align: center; padding: 40px;
}
#title-main {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 22px;
}
#screen-title h1 { font-size: 34px; margin: 0 0 6px; letter-spacing: 2px; }
#screen-title p { font-size: 15px; opacity: .75; margin: 0 0 8px; line-height: 1.7; max-width: 520px; }
.btn {
    padding: 13px 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.08); color: inherit; font-size: 14.5px; cursor: pointer;
    transition: background .15s;
}
.btn:hover { background: rgba(255,255,255,.18); }
.btn-primary { background: #c99a4b; border-color: #c99a4b; color: #1c1712; font-weight: 700; }
.btn-primary:hover { background: #d9ab5c; }

/* 메인으로 돌아가기(타이틀 화면 전용): 버튼 그룹과 분리해서 화면 하단에 배치 */
.link-home {
    position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
    color: rgba(243,233,216,.55); font-size: 13px;
    text-decoration: none; border-bottom: 1px solid transparent;
}
.link-home:hover { color: rgba(243,233,216,.85); border-bottom-color: rgba(243,233,216,.55); }


/* ---------- 씬(배경 placeholder) ----------
   PC 와이드스크린 VN 레이아웃: 배경이 프레임 전체를 채우고,
   대사창은 하단에 폭을 제한한 채(가운데 정렬) 오버레이되는 형태 */
#screen-scene { background: #333; }
#bg-layer {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.35); font-size: 14px; letter-spacing: 2px;
    text-transform: uppercase;
    background-size: cover; background-position: center; background-repeat: no-repeat;
}
#bg-label { border: 1px dashed rgba(255,255,255,.25); padding: 8px 18px; border-radius: 6px; }
#bg-layer.has-image #bg-label { display: none; }

#dialogue-dock {
    position: absolute; left: 0; right: 0; bottom: 2%; z-index: 1;
    padding: 0 6%;
    display: flex; flex-direction: column; align-items: center;
}
/* '대화창 끄기' 켜졌을 때 대사창+선택지 전체를 숨김 (배경만 보이게) */
#dialogue-dock.dialogue-hidden { display: none; }

#choice-layer {
    order: 1; width: 100%; max-width: 920px; margin: 0 0 8px;
    display: flex; flex-direction: column; gap: 6px;
}
.choice-btn {
    text-align: left; padding: 9px 18px; border-radius: 12px;
    background: rgba(18,15,11,.5);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
    color: #f0ead9; font-size: 13.5px; cursor: pointer; line-height: 1.35;
    transition: background .15s, border-color .15s;
}
.choice-btn:hover { background: rgba(201,154,75,.14); border-color: #c99a4b; }

#text-box {
    position: relative;
    order: 2; color: #f0ead9; width: 100%; max-width: 920px;
    min-height: 84px;
    display: flex; align-items: center;
    padding: 18px 26px;
    background: rgba(18,15,11,.62);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(0,0,0,.32);
}
#speaker { font-size: 13px; color: #c99a4b; margin-bottom: 6px; font-weight: 700; display: none; }
#story-text { text-align: left; font-size: 15px; line-height: 1.65; white-space: pre-line; }
#advance-hint {
    position: absolute; right: 16px; bottom: 12px;
    font-size: 11.5px; opacity: .45; margin: 0;
}

/* ---------- 엔딩 ---------- */
#screen-ending {
    justify-content: center; align-items: center; text-align: center;
    background: linear-gradient(160deg, #22262b, #101214); color: #f0ead9; padding: 40px; gap: 10px;
}
#ending-name { font-size: 13px; letter-spacing: 4px; opacity: .6; }
#ending-title { font-size: 32px; font-weight: 700; margin: 6px 0 2px; }
#ending-score { font-size: 14px; opacity: .6; margin-bottom: 16px; }
#ending-desc { font-size: 15px; line-height: 1.8; opacity: .9; max-width: 460px; margin-bottom: 30px; }

/* ---------- 결과(오늘의 참배 돌아보기) ---------- */
#screen-result { background: #f7f3ea; color: #2c2418; overflow-y: auto; padding: 36px 6% 40px; }
#result-inner { max-width: 960px; margin: 0 auto; width: 100%; }
#result-summary { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
#result-summary small { display: block; font-weight: 400; font-size: 13px; color: #7a6c55; margin-top: 6px; }
.result-section-title { font-size: 13px; font-weight: 700; color: #7a6c55; margin: 26px 0 10px; letter-spacing: 1px; }
#checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.check-item { font-size: 14px; padding: 10px 12px; border-radius: 6px; background: #fff; border: 1px solid #e8dfca; }
.check-item.correct { color: #3a6b3a; }
.check-item.wrong { color: #a05a3a; }
#review-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.review-card {
    background: #fff; border: 1px solid #e8dfca; border-radius: 10px; padding: 18px 20px;
}
.review-card h4 { margin: 0 0 12px; font-size: 15px; }
.review-row { font-size: 13.5px; margin-bottom: 7px; line-height: 1.6; }
.review-row b { color: #7a6c55; font-weight: 700; margin-right: 4px; }
.review-explain { font-size: 13.5px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e0d5ba; line-height: 1.65; color: #4a4030; }
.todo-tag { display: inline-block; font-size: 10px; background: #f0dede; color: #a04040; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
#result-actions { margin-top: 28px; display: flex; flex-direction: row; gap: 10px; }
#result-actions .btn { color: #2c2418; border-color: #d8cba4; }
#result-actions .btn-primary { background: #c99a4b; color: #fff; border-color: #c99a4b; }

/* ---------- 엔딩 도감 ---------- */
#screen-collection { background: #1c1712; color: #f0ead9; padding: 36px 6%; align-items: center; }
#collection-inner { max-width: 760px; width: 100%; }
#collection-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 20px 0 24px; }
.collection-cell {
    aspect-ratio: 1; border-radius: 8px; border: 1px solid rgba(255,255,255,.15);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 11.5px; text-align: center; padding: 8px; background: rgba(255,255,255,.04);
}
.collection-cell.unlocked { background: rgba(201,154,75,.18); border-color: #c99a4b; }
.collection-cell .mark { font-size: 22px; margin-bottom: 6px; }