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

body { font-family: 'Jua', sans-serif; overflow: hidden; }

.main-map {
    width: 100vw; height: 100vh;
    background-image: url('../images/main/bg.webp'); /* 확장자 꼭 확인하세요! */
    background-size: cover; background-position: center;
    position: relative; /* 자식 요소들의 절대 위치 기준점이 됩니다 */
}

.top-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mini-login-btn {
    display: flex; align-items: center; padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9); border: 2px solid #ddd;
    border-radius: 30px; cursor: pointer; font-family: 'Jua', sans-serif; font-size: 1rem;
}
.mini-icon { width: 20px; margin-right: 10px; }
#user-info { background: rgba(255, 255, 255, 0.9); padding: 10px 20px; border-radius: 30px; font-weight: bold; }

/* =========================================
   공통 디자인 (표지판과 집)
========================================= */
.village-tree {
    position: absolute;
    height: auto;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.18));
}

.village-tree--back {
    z-index: 3;
}

.village-tree--front {
    z-index: 12;
}

.signpost {
    position: absolute;
    z-index: 20;
    cursor: pointer;
    transition: transform 0.2s ease-out;
}

.signpost:hover {
    transform: scale(1.1); 
}

/* 표지판 이미지 크기를 부모 크기에 맞춤 */
.sign-img {
    width: 100%; 
    filter: drop-shadow(0px 5px 5px rgba(0,0,0,0.2)); 
}

.house {
    position: absolute;
    z-index: 10;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.2s ease-out;
    /* width: 120px; <-- 절대 넣지 마세요! */
}

.house:hover { 
    transform: scale(1.1); 
}

/* 🌟 여기가 핵심입니다! 집 이미지들이 부모 크기에 딱 맞게 찌그러지지 않고 변함 */
.roof-img {
    width: 100%;
    filter: drop-shadow(0px 5px 5px rgba(0,0,0,0.2)); /* 집에도 살짝 그림자 추가 */
}

/* =========================================
   각 요소의 위치와 크기 지정 (완벽한 원근감)
========================================= */

/* 표지판 — 국어마을 / 수학마을 안내 */
#sign-kor { bottom: 0%;
    left: 78%;
    width: 11vw; }
#sign-math { bottom: 1%;
    right: 45%;
    width: 10vw; }

/* 나무 — 종류별 2그루 (뒤=집 뒤 z3, 앞=집 앞 z12) */
#tree-1a { bottom: 11%; left: 0; width: 8vw; }
#tree-1b { bottom: 0; left: 17%; width: 9.5vw; }

#tree-2a { top: 31%; left: 52%; width: 5vw; }
#tree-2b { bottom: 1%; left: 38%; width: 8.5vw; }

#tree-3a { top: 30%; left: 22%; width: 6vw; }
#tree-3b { bottom: 20%; right: 4%; width: 8vw; }

.learning-menu-btn {
    border-color: #ff80ab;
    color: #ad1457;
}

/* 🏠 국어마을 (다시 width vw 수치로 변경!) */
#kor-1 { top: 48%;
    left: 75%;
    width: 14vw; } /* 맨 앞 */
#kor-2 { top: 40%;
    left: 88%;
    width: 12vw;}
#kor-3 { top: 34%;
    left: 75%;
    width: 11vw; }
#kor-4 { top: 30%;
    left: 87%;
    width: 6vw; }


/* 🏠 수학마을 */
#math-1 { top: 52%;
    left: 47%;
    width: 13vw; }
#math-2 {top: 39%;
    left: 13%;
    width: 10vw; }
#math-3 {top: 40%;
    left: 35%;
    width: 9vw; }
#math-4 { top: 35%;
    left: 56%;
    width: 9vw; }
#math-5 { top: 31%;
    left: 45%;
    width: 8vw; }
#math-6 { top: 32%;
    left: 27%;
    width: 9vw; }
#math-7 { top: 26%;
    left: 4%;
    width: 9vw; }

    /* 모달 배경 (어두운 반투명) */
.modal-overlay {
  display: none; /* 처음에는 숨김 */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

/* 모달 창 안의 게임 컨테이너 */
.modal-content {
 position: relative;
  width: 100%;       /* 가로를 화면 끝까지 */
  height: 100vh;     /* 세로를 화면 높이 100%로 */
  max-width: none;   /* 최대 너비 제한 해제 */
  background-color: #ffffff; /* 배경색을 흰색으로 고정 */
  overflow: hidden;  /* 내부 스크롤 방지 */
}

/* iframe (게임 화면이 들어갈 액자) */
#gameFrame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 20px;
  background-color: transparent;
}

/* 닫기 버튼 */
.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1001;     /* 게임 화면보다 위에 보이게 */
  background: #ff4757;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;       /* 누르기 편하게 조금 더 크게 */
  height: 50px;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3); /* 눈에 잘 띄게 그림자 추가 */
}