:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --container-bg: #ffffff;
    --container-border: #ddd;
    --stats-bg: #f0f2f5;
    --stats-text: #333333;
    --money-color: #27ae60;
    --log-text: #7f8c8d;
    --log-border: #eee;
    --button-bg: #3498db;
    --button-text: #ffffff;
    --intro-bg: rgba(0, 0, 0, 0.7);
    --intro-box-bg: #fdfdfd;
    --intro-box-border: #3498db;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --container-bg: #2c3e50;
    --container-border: #4a6572;
    --stats-bg: #34495e;
    --stats-text: #ffffff;
    --money-color: #2ecc71;
    --log-text: #95a5a6;
    --log-border: #4a6572;
    --button-bg: #3498db;
    --button-text: #ffffff;
    --intro-bg: rgba(0, 0, 0, 0.9);
    --intro-box-bg: #2c3e50;
    --intro-box-border: #3498db;
}

body { 
    font-family: 'Apple SD Gothic Neo', sans-serif; 
    background: var(--bg-color); 
    color: var(--text-color);
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; /* height -> min-height */
    margin: 0; 
    transition: background 0.3s, color 0.3s;
}

/* 인트로 화면 스타일 */
#intro-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--intro-bg);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 100; transition: 0.5s;
}
.intro-box { 
    text-align: center; 
    background: var(--intro-box-bg); 
    color: var(--text-color);
    padding: 40px; 
    border-radius: 20px; 
    border: 2px solid var(--intro-box-border); 
}
.url-text { 
    color: #3498db; 
    font-family: monospace; 
    margin-bottom: 20px; 
    display: block; 
}

/* 게임 컨테이너 (기본은 숨김) */
.game-container { 
    position: relative;
    background: var(--container-bg); 
    padding: 20px; /* Adjust padding for wider layout */
    border-radius: 15px; 
    width: 90%; /* Changed from 400px */
    max-width: 1200px; /* Max width for larger screens */
    min-height: 600px; /* Ensure minimum height */
    color: var(--text-color); 
    display: flex; /* Use flexbox */
    flex-direction: row; /* Horizontal layout */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 20px; /* Space between sections */
    border: 1px solid var(--container-border);
}

/* 버튼 스타일 */
button { 
    cursor: pointer; 
    border: none; 
    border-radius: 5px; 
    padding: 12px 25px; 
    transition: 0.2s; 
    font-weight: bold; 
    margin: 5px; 
}
.btn-login { 
    background: var(--button-bg); 
    color: var(--button-text); 
    width: 200px; 
}
.btn-guest { 
    background: #95a5a6; 
    color: var(--button-text); 
    width: 200px; 
}
.btn-work { 
    width: 100%; 
    background: #34495e; 
    color: var(--button-text); 
    font-size: 18px; 
    margin-bottom: 20px; 
}

/* 테마 토글 버튼 */
.header-utils {
    position: absolute;
    top: 15px;
    right: 15px;
}
#theme-toggle {
    background: transparent;
    border: 1px solid var(--container-border);
    color: var(--text-color);
    padding: 5px 10px;
    font-size: 18px;
}

/* 기존 게임 스타일 유지 */
.stats { 
    background: var(--stats-bg); 
    color: var(--stats-text); 
    padding: 20px; 
    border-radius: 10px; 
    margin-bottom: 20px; 
}
.money { 
    font-size: 24px; 
    font-weight: bold; 
    color: var(--money-color); 
}
.stock-market { 
    border: 1px solid var(--container-border); 
    padding: 15px; 
    border-radius: 10px; 
}
.stock-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.price-up { 
    color: #e74c3c; 
    font-weight: bold; 
}
.price-down { 
    color: #3498db; 
    font-weight: bold; 
}
.log { 
    font-size: 12px; 
    color: var(--log-text); 
    height: 60px; 
    overflow-y: auto; 
    margin-top: 15px; 
    border-top: 1px solid var(--log-border); 
    padding-top: 10px; 
}

/* 로그인 모달 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 10px;
    width: 320px;
    text-align: center;
    border: 1px solid var(--container-border);
}

.modal-content h2 {
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 5px;
    border: 1px solid var(--container-border);
    background: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box; /* 패딩 포함해서 너비 계산 */
}

.modal-content .btn-login {
    width: 100%;
}

.btn-close-modal {
    background: #7f8c8d;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.hidden {
    display: none;
}

/* Tab Menu Styles */
.tab-menu {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.tab-menu button {
    flex: 1;
    background: var(--stats-bg);
    color: var(--stats-text);
    border: 1px solid var(--container-border);
    padding: 10px 5px;
    font-size: 14px;
}

.tab-menu button:hover {
    filter: brightness(1.1);
}

.tab-menu button[style*="background:#f1c40f"] { /* 재테크 탭 버튼 */
    color: #000 !important;
}
.tab-menu button[style*="background:#9b59b6"] { /* 부동산 탭 버튼 */
    color: white !important;
}


/* Invest Item Styles */
.invest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--log-border);
}

.invest-item:last-child {
    border-bottom: none;
}

.invest-item button {
    padding: 8px 15px;
    font-size: 13px;
    margin-left: 5px;
    width: auto; /* override default button width */
}

/* Specific button colors for consistency */
.invest-item button[onclick*="buyAsset"] {
    background: #2ecc71; /* Green for buy */
    color: white;
}
.invest-item button[onclick*="sellAsset"] {
    background: #e74c3c; /* Red for sell */
    color: white;
}
.invest-item button[onclick*="buyBuilding"] {
    background: #3498db; /* Blue for buy building */
    color: white;
}

/* Game Panels Layout */
#game-left-panel {
    flex: 0 0 250px; /* Fixed width for left panel */
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-right: 10px;
    border-right: 1px solid var(--container-border);
}

#game-center-panel {
    flex: 1; /* Takes remaining space */
    display: flex;
    flex-direction: column;
    padding: 0 10px;
}

#game-right-panel {
    flex: 0 0 250px; /* Fixed width for right panel (log) */
    display: flex;
    flex-direction: column;
    padding-left: 10px;
    border-left: 1px solid var(--container-border);
}

/* Adjust log height within the new panel */
#game-right-panel .log {
    flex: 1; /* Allow log to fill available vertical space */
    max-height: 100%; /* Ensure it doesn't overflow its parent */
}
