* { 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-math.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;
    display: block;
    text-decoration: none;
    color: inherit;
}

.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); 
}

.house.is-guest-locked,
.signpost.is-guest-locked {
  cursor: not-allowed;
  filter: grayscale(0.55) brightness(0.92);
  opacity: 0.72;
}

.house.is-guest-locked:hover,
.signpost.is-guest-locked:hover {
  transform: none;
}

.house.is-guest-locked::after,
.signpost.is-guest-locked::after {
  content: "로그인";
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: clamp(9px, 1.1vw, 12px);
  font-weight: 700;
  letter-spacing: -0.02em;
  pointer-events: none;
  white-space: nowrap;
}

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

/* =========================================
   수학학습방 핫스팟 배치 (index · og-village 공유)
   너비는 .main-map 기준 % — OG 1200×630과 비율 맞춤
========================================= */
#curriculum-math { left: 40%; bottom: 60%; width: 6%; z-index: 22; }
#worksheet-math { bottom: 1%; right: 45%; width: 6%; }
#sign-eng { bottom: 8%; left: 1%; width: 9%; }
#sign-kor { bottom: 8%; right: 1%; width: 9%; }

#tree-1a { bottom: 0%; left: 27%; width: 8%; }
#tree-1b { bottom: 0; left: 17%; width: 9.5%; }
#tree-2a { top: 31%; left: 52%; width: 5%; }
#tree-2b { bottom: 1%; left: 38%; width: 8.5%; }
#tree-3a { top: 30%; left: 10%; width: 6%; }
#tree-3b { bottom: 20%; right: 4%; width: 8%; }

#math-1 { top: 50%; left: 45%; width: 13%; }   /* math5.webp · 수세기 */
#math-2 { top: 39%; left: 11%; width: 10%; }   /* math6.webp · 수의 순서 */
#math-3 { top: 40%; left: 35%; width: 9%; }    /* math7.webp · 자릿값 */
#math-4 { top: 30%; left: 56%; width: 9%; }    /* math8.webp · 규칙 찾기 */
#math-5 { top: 28%; left: 23%; width: 8%; }    /* math9.webp · 모양.측정 */
#math-side-1 { top: 50%; left: 75%; width: 13%; } /* math1.webp · 덧셈뺄셈 */
#math-side-2 { top: 40%; left: 88%; width: 11%; } /* math2.webp · 곱셈나눗셈 */
#math-8 { top: 30%; left: 75%; width: 10%; }   /* math3.webp · 분수 */

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

    /* 모달 배경 (어두운 반투명) */
.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); /* 눈에 잘 띄게 그림자 추가 */
}
