/* --- [1] 기본 및 화면 분리 --- */
body {
    margin: 0; padding: 10px; font-family: sans-serif;
    display: flex; flex-direction: column; align-items: center;
    background-color: #f0f0f0;
}

#gameScene {
    display: none; /* 게임 화면은 처음엔 숨김 */
    width: 100%;
}

/* --- [2] 대기실 UI --- */
#lobbyScene {
    text-align: center;
}
#lobbyScene h1 {
    color: #ff4757;
}
#nicknameInput {
    padding: 10px; font-size: 16px; width: 80%; max-width: 300px; margin-bottom: 15px;
    border-radius: 5px; border: 1px solid #ccc;
}
#characterSelection {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 10px; /* 이미지 간격 */
    margin-bottom: 20px;
}
.unit-char {
    width: 80px; height: 80px; object-fit: contain; cursor: pointer;
    border: 3px solid transparent; /* 기본 테두리는 투명 */
    border-radius: 10px;
    transition: border-color 0.2s;
}
.unit-char.selected { /* 선택된 캐릭터 하이라이트 */
    border-color: #ff4757;
    box-shadow: 0 0 10px #ff4757;
}

/* 일반 버튼 공통 스타일 */
button {
    padding: 12px 24px; font-size: 18px; cursor: pointer; font-weight: bold;
    background-color: #ff4757; color: white; border: none; border-radius: 8px;
}

/* --- [3] 게임 화면 UI (주사위 버튼 보드판 안으로 이동) --- */
.ui-container {
    text-align: center; 
    margin-bottom: 10px;
    min-height: 80px; /* 버튼이 보드판으로 가서 텍스트 공간만 남김 */
    display: flex; 
    flex-direction: column; 
    align-items: center;
    justify-content: center;
}

#resultText {
    min-height: 60px; 
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #333;
}

/* --- [4] 보드판 및 둥둥 떠다니는 버튼 --- */
#boardContainer {
    position: relative;
    width: 100%; max-width: 600px; aspect-ratio: 1 / 1.4;
    background-image: url('image/board.png');
    background-size: 100% 100%;
    border: 3px solid #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    margin: 0 auto; /* 보드판을 무조건 중앙으로 정렬 */
    overflow: hidden; /* 버튼이 보드판 밖으로 나가지 않게 가둠 */
}

/* 🎲 보드판 위에 둥둥 떠다니는 주사위 버튼 */
#rollDiceBtn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100; /* 모든 말보다 무조건 위에 오도록 설정 */
    padding: 15px 30px; 
    font-size: 22px; 
    font-weight: bold;
    background-color: #ff4757; 
    color: white; 
    border: 4px solid white; 
    border-radius: 30px; 
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: top 0.4s ease, bottom 0.4s ease, background-color 0.3s, transform 0.1s;
}

/* 내 턴이 아닐 때의 주사위 버튼 모습 (회색 & 비활성화) */
#rollDiceBtn:disabled {
    background-color: #555;
    border-color: #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: translateX(-50%) scale(0.95); /* 살짝 작아지는 효과 */
}