/* 1. 전체 기본 설정 */
body {
    margin: 0;
    overflow: hidden; /* 스크롤바 없애기 */
    background-color: #000;
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}

/* 2. 로그인 화면 (게임 시작 전) */
#login-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #222; /* 어두운 배경 */
    z-index: 100; /* 제일 위에 표시 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#nickname-input {
    padding: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    width: 200px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 5px;
}

#start-btn {
    padding: 12px 30px;
    font-size: 18px;
    background: #FFD700; /* 금색 버튼 */
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 5px;
    transition: background 0.2s;
}

#start-btn:hover {
    background: #ffcc00;
}

/* 3. 로딩 메시지 */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    z-index: 20;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 40px;
    border-radius: 10px;
    display: none; /* 기본은 숨김 */
}

/* 4. 미니맵 (왼쪽 상단) */
#minimap {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%; /* 원형 */
    z-index: 60;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* 5. 감정표현 버튼 (오른쪽 중간) */
#emote-bar {
    position: absolute;
    right: 20px;
    top: 30%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 50;
}

.emote-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.emote-btn:hover {
    transform: scale(1.1);
}

.emote-btn:active {
    transform: scale(0.95);
    background: #FFD700;
}

/* 6. 채팅창 (왼쪽 하단) */
#chat-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 320px;
    height: 250px;
    display: flex;
    flex-direction: column;
    z-index: 50;
    pointer-events: none; /* 채팅창 배경은 클릭 통과 */
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    list-style: none;
    color: white;
    font-size: 14px;
    pointer-events: auto; /* 메시지 스크롤은 가능하게 */
}

#chat-messages li {
    margin-bottom: 5px;
    word-wrap: break-word;
}

/* 내 메시지와 상대 메시지 색상 구분 */
.my-msg { color: #FFD700; font-weight: bold; }
.other-msg { color: #FFFFFF; }

#chat-input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.95);
    outline: none;
    pointer-events: auto; /* 입력창 클릭 가능하게 */
    box-sizing: border-box;
}

/* 7. 유튜브 팝업 */
#video-popup {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 640px;
    background: #222;
    padding: 10px;
    border-radius: 15px;
    border: 3px solid white;
    z-index: 80;
    text-align: center;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

#video-popup iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 5px;
}

#popup-msg {
    color: #ccc;
    margin-top: 10px;
    font-size: 14px;
}

/* 8. 줌 컨트롤 (우측 슬라이더) */
#zoom-container {
    position: absolute;
    right: 100px;
    top: 50%;
    transform: translateY(-50%);
    height: 200px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

#zoom-slider {
    writing-mode: bt-lr; /* IE, Edge */
    -webkit-appearance: slider-vertical; /* Chrome, Safari */
    width: 8px;
    height: 150px;
    cursor: pointer;
    margin-top: 10px;
}

/* 9. 모바일 컨트롤러 (조이스틱 & 점프) */
#joystick-zone {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: grid;
    grid-template-columns: 60px 60px 60px;
    grid-template-rows: 60px 60px;
    gap: 10px;
    z-index: 10;
    user-select: none;
}

#jump-zone {
    position: absolute;
    bottom: 40px;
    right: 40px;
    z-index: 10;
    user-select: none;
}

.btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.btn:active {
    background: rgba(255, 255, 255, 0.5);
}

.btn-jump {
    width: 80px;
    height: 80px;
    background: rgba(255, 200, 0, 0.4);
    border: 2px solid rgba(255, 200, 0, 0.8);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-jump:active {
    background: rgba(255, 200, 0, 0.8);
}

/* 그리드 배치 */
#btn-up { grid-column: 2; grid-row: 1; }
#btn-left { grid-column: 1; grid-row: 2; }
#btn-down { grid-column: 2; grid-row: 2; }
#btn-right { grid-column: 3; grid-row: 2; }

/* 10. PC 화면에서는 모바일 컨트롤러 숨김 */
@media (min-width: 1024px) {
    #joystick-zone, #jump-zone {
        display: none;
    }
}