/* =========================================
   [공통] 전체 레이아웃 & 스크롤 설정 (Fixed)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;600&display=swap');

:root {
    --bg-dark: #0f172a;
    --primary: #3b82f6;
    --accent: #f59e0b;
    --text-main: #f8fafc;
    --vh: 1vh; 
}

* { box-sizing: border-box; }

/* 1. 전체 화면 고정 (바깥 스크롤 방지) */
body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    /* 모바일 브라우저 툴바 제외 실제 높이 */
    height: calc(var(--vh, 1vh) * 100);
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Exo 2', sans-serif;
    overflow: hidden; /* body 스크롤 막음 */
    position: fixed; /* iOS 튕김 방지 */
}

/* 2. 최상위 컨테이너 */
#app-viewport, 
.view-container {
    width: 100%; 
    height: 100%;
    display: flex; 
    flex-direction: column; /* 세로 정렬 */
    overflow: hidden; /* 자식이 넘치면 숨김 (자식 내부에서 스크롤) */
    position: relative;
}

/* 로그인 화면은 예외적으로 전체 스크롤 */
.view-container.auth-mode {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: center; justify-content: center;
    padding: 20px;
}

/* -------------------------------------------
   [로비 레이아웃 핵심: Header - Content - Footer]
   ------------------------------------------- */

/* [1. 상단] 높이 고정 */
#balance-container, 
#game-header {
    flex: 0 0 auto; /* 줄어들지 않음 */
    width: 100%;
    z-index: 50;
    background: var(--bg-dark);
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* [2. 중앙] 스크롤 영역 (여기가 핵심!) */
.tab-system, 
#game-board {
    /* [매우 중요] flex-basis를 0으로 설정해야 부모 높이에 맞춰짐 */
    flex: 1 1 0px; 
    
    width: 100%;
    height: 100%; /* 부모의 남은 공간을 꽉 채움 */
    
    overflow-y: scroll !important; /* 스크롤 강제 */
    overflow-x: hidden;
    
    position: relative;
    padding: 0;
    
    /* [중요] 하단바에 내용이 가려지지 않도록 넉넉한 여백 추가 */
    padding-bottom: 150px !important; 
    
    -webkit-overflow-scrolling: touch; /* 부드러운 스크롤 */
}

/* 탭 내용물 */
.tab-content {
    width: 100%;
    height: auto; /* 내용만큼 늘어남 */
    display: block;
}

/* [3. 하단] 네비게이션바 (고정) */
.bottom-nav {
    flex: 0 0 70px; /* 높이 고정 */
    width: 100%;
    position: relative; /* fixed 아님! flex 흐름에 태움 */
    background: #0f172a;
    border-top: 1px solid #334155;
    
    display: flex; 
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    
    /* 아이폰 홈바 대응 */
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(70px + env(safe-area-inset-bottom));
}

/* -------------------------------------------
   [UI 디자인 및 애니메이션]
   ------------------------------------------- */
.balance-wrapper {
    background: linear-gradient(to right, #1e293b, #0f172a);
    padding: 8px 15px 5px 15px; 
    text-align: center;
    border-bottom: 1px solid #334155;
    position: relative;
    z-index: 2;
}
.balance-label { font-size: 0.7rem; color: #94a3b8; letter-spacing: 1px; margin-bottom: 2px; }
.balance-amount { font-size: 1.4rem; font-weight: 900; color: #fff; font-family: 'Orbitron', sans-serif; line-height: 1.2; }

.notification-ticker {
    width: 100%; height: 30px; 
    background: #000;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
    border-bottom: 1px solid #334155;
}
.ticker-text {
    font-size: 0.8rem; white-space: nowrap; color: #cbd5e1;
    font-family: 'Exo 2', sans-serif;
    opacity: 0; transition: opacity 0.5s;
    display: flex; align-items: center; gap: 5px;
}
.ticker-text.show { opacity: 1; animation: slideUpFade 0.5s ease-out; }
@keyframes slideUpFade { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.jackpot-msg { color: #ffd700; font-weight: bold; text-shadow: 0 0 5px #d4af37; animation: pulseGold 1s infinite; }
@keyframes pulseGold { 0% { transform: scale(1); text-shadow: 0 0 5px #d4af37; } 50% { transform: scale(1.05); text-shadow: 0 0 15px #ffd700; } 100% { transform: scale(1); text-shadow: 0 0 5px #d4af37; } }

.neon-btn {
    background: transparent; color: var(--primary); border: 2px solid var(--primary);
    padding: 12px 20px; font-family: 'Orbitron', sans-serif; font-weight: bold;
    cursor: pointer; border-radius: 8px; width: 100%; font-size: 1rem;
    transition: 0.2s; margin-top: 10px;
}
.neon-btn:hover { background: var(--primary); color: #000; }
.neon-btn:active { transform: scale(0.96); }
.neon-btn.primary { color: #3b82f6; border-color: #3b82f6; }
.neon-btn.secondary { color: #a855f7; border-color: #a855f7; }
.neon-btn.success { color: #10b981; border-color: #10b981; }

.text-btn { background: none; border: none; color: #94a3b8; text-decoration: underline; margin-top: 10px; cursor: pointer; }
.nav-item { background: none; border: none; color: #64748b; font-size: 0.7rem; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; flex: 1; padding: 5px 0; }
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 1.5rem; margin-bottom: 2px; }
.neon-input { width: 100%; padding: 12px; background: rgba(30, 41, 59, 0.5); border: 1px solid #475569; border-radius: 8px; color: #fff; font-size: 1rem; outline: none; }
.neon-input:focus { border-color: var(--primary); }
