/* [1] 강제 초기화: style.css의 flex/justify-content 설정을 무력화 */
html, body {
    display: block !important; /* 무조건 블록 모드 */
    height: 100% !important;
    min-height: 100% !important;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto !important;
    background-color: #f8fafc !important; /* 연한 그레이 블루 */
    text-align: center; /* 모든 자식 요소 가로 중앙 정렬 */
}

body {
    background: radial-gradient(circle at top, #f8fafc 0%, #e2e8f0 100%) !important;
}

/* [2] 전체 컨테이너: 화면 중앙 정렬 및 여백 확보 */
.content-wrapper {
    display: flex !important;
    width: 100% !important;
    max-width: 500px !important; /* S25 울트라 최적 너비 */
    margin: 0 auto !important;
    padding: 40px 20px 80px 20px !important;
    box-sizing: border-box !important;
    text-align: center;
    flex-direction: column !important;
    justify-content: center !important; /* 세로 정중앙 */
    align-items: center !important;     /* 가로 정중앙 */
    height: 100vh !important;           /* 화면 전체 높이 사용 */
    height: 100dvh !important;          /* 주소창 제외 실제 높이 대응 */
    min-height: 100dvh !important; /* 최소 높이는 유지하되 */
    height: auto !important;       /* 내용이 많아지면 늘어나게 */
    position: relative;
}

/* [3] 메인 박스: 배경색을 빼거나 넣어서 조절 가능 */
.main-container {
    display: flex !important;
    width: 100% !important;
    max-width: 500px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important; /* 박스 형태가 깨지면 투명하게 */
    box-shadow: none !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* [4] 로고 및 제목 스타일 */
.rotating-logo {
    width: 160px !important;
    height: 160px !important;
    border-radius: 50%;
    margin-bottom: 20px;
    animation: rotate_logo 50s linear infinite;
}

@keyframes rotate_logo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    margin: 10px 0 40px 0 !important;
    letter-spacing: 1px;
    text-align: center;
    width: 100% !important;
    word-break: keep-all; /* 한글/영어 단어가 잘리지 않게 */
}

/* [5] 메뉴 및 버튼 그룹 */
.menu-group {
    display: flex !important;
    flex-direction: column !important; /* 세로로 쌓기 */
    gap: 10px !important;            /* 버튼 사이 간격을 20px로 확실히 벌림 */
    width: 90% !important;
    margin: 0 auto !important;
}

.menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 18px !important;
    border-radius: 16px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    border: none !important;
    background: #ffffff !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 
                0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

.menu-btn.party { border-bottom: 4px solid #3b82f6 !important; background: #eff6ff !important; }
.menu-btn.admin { border-bottom: 4px solid #ef4444 !important; }

/* [6] 캐릭터 카드 (파티원 선택 시) */
.member-card {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    margin-bottom: 12px;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    text-align: left !important;
    border-left: none !important; /* 기존 두꺼운 선 제거 */
    position: relative !important; /* 이게 있어야 빨간 바가 카드에 붙습니다 */
    padding: 15px 20px 15px 30px !important; /* 왼쪽 여백은 바가 들어갈 자리 */
    overflow: hidden; /* 바가 튀어나가지 않게 */
    border-radius: 16px !important;
}

/* 1. 빨간색 바 위치 교정: 왼쪽 끝에 꽉 차게 */
.member-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0 !important;      /* 맨 위에서부터 */
    height: 100% !important; /* 아래까지 꽉 차게 */
    width: 8px !important;    /* 조금 더 도톰하게 */
    background: #ef4444 !important;
    border-radius: 16px 0 0 16px !important;
}

/* 2. 혹시나 각 버튼에 마진이 0으로 고정되어 있을 경우를 대비 */
.menu-btn, .member-card {
    margin-bottom: 0 !important;    /* gap을 사용할 때는 마진을 0으로 하는 게 정석 */
    flex-shrink: 0 !important;      /* 버튼이 찌그러지지 않게 보호 */
}

/* 버튼 터치/호버 시 살짝 떠오르는 효과 */
.menu-btn:active {
    transform: translateY(2px) scale(0.98) !important;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1) !important;
}

/* [7] 푸터: 컨텐츠 바로 아래 자연스럽게 위치 */
.footer-text {
    display: block !important;
    width: 100% !important;
    padding-bottom: 60px !important; /* 하단바 가림 방지 */
    color: #94a3b8 !important;
    font-size: 0.8rem !important;
    border: none !important;
    text-align: center !important;
    margin: 0 !important;
    position: relative !important; /* absolute 해제! */
    margin-top: 50px !important;   /* 컨텐츠와 간격 유지 */
    bottom: 0 !important;
    padding: 20px 0 !important;
}

/* [8] 월드 칩 보정 */
.world-chip-container {
    display: flex !important;
    justify-content: center !important;
    margin-bottom: 15px !important;
}

/* 모바일 전용 미세 조정 (S25 울트라) */
@media (max-width: 480px) {
    .content-wrapper { padding: 30px 15px 0 15px !important; }
    .rotating-logo { width: 140px !important; height: 140px !important; }
}

/* 1. 각 화면(View)이 부모의 너비를 100% 사용하도록 설정 */
#home-view {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; /* 내부 요소들 가로 중앙 */
    justify-content: center !important;
}

/* 4. 로고와 텍스트 간격 미세 조정 */
.logo-section {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
}

/* 3. 선택 화면(selection-list)도 동일하게 적용 */
#selection-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
}

/* 1. 뷰(View) 전환 시 레이아웃 초기화 */
#home-view, #selection-view {
    width: 100% !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* 2. 홈 뷰가 display: none 되면 공간을 완전히 비워줌 */
#home-view[style*="display: none"] {
    display: none !important;
}

/* 3. 선택 뷰가 켜질 때 (중앙 정렬 유지) */
#selection-view[style*="display: block"] {
    display: flex !important; /* block 대신 flex로 켜서 중앙 정렬 유지 */
    min-height: 60vh !important; /* 목록이 적어도 화면 중앙에 오도록 높이 확보 */
    justify-content: center !important;
}

/* 4. 뒤로가기 버튼 스타일 (목록 맨 아래에 예쁘게 배치) */
.back-btn {
    margin-top: 30px !important;
    width: auto !important;
    min-width: 120px;
    padding: 12px 20px !important;
    border-radius: 30px !important;
    font-size: 0.9rem !important;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #475569 !important;
    font-weight: 600 !important;
}

/* 2. 글자 디자인 및 간격 재정렬 */
.member-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 10px; /* 빨간 바와의 간격 확보 */
    gap: 2px !important; /* 직업명과 이름 사이 간격 좁게 */
}

/* 직업명: 작고 단단하게 (태그 느낌) */
.m-class {
    font-size: 0.7rem !important;
    font-weight: 800 !important;
    color: #ef4444 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 !important;
}

/* 캐릭터 이름: 묵직하고 가독성 좋게 */
.m-name {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

/* 아래쪽 부가 정보 (Adventure Awaits 등) */
.m-meta {
    font-size: 0.85rem !important;
    color: #94a3b8 !important;
    margin-top: 4px !important;
}

/* 3. 오른쪽 화살표: 너무 튀지 않게 조정 */
.m-arrow {
    color: #cbd5e1 !important;
    font-size: 1.1rem;
    padding-right: 5px;
}