* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

html { 
    width: 100%; 
    height: 100%;
    overflow: hidden;
}

body { 
    width: 100%; 
    height: 100%;
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Roboto, sans-serif; 
    background: #121212; 
    display: flex; 
    justify-content: center; 
    align-items: flex-start;
    overflow: hidden;
    position: fixed;
}

/* APP CONTAINER - LOCKED SIZE */
.app-container { 
    width: 100%;
    max-width: 420px; 
    height: 100vh;
    background: #1e1e1e; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 0 30px rgba(0,0,0,0.8); 
    position: relative; 
    overflow: hidden;
}

/* CHARACTER CREATION SCREEN */
.char-creation-screen { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 200; 
}

.char-creation-box { 
    background: #2c2c2c; 
    padding: 40px; 
    border-radius: 15px; 
    text-align: center; 
    width: 85%; 
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8); 
    border: 2px solid #667eea; 
}

.char-creation-box h1 { 
    margin-top: 0; 
    font-size: 32px; 
    color: white; 
}

#char-name { 
    width: 100%; 
    padding: 15px; 
    margin: 20px 0; 
    font-size: 18px; 
    border: 2px solid #667eea; 
    border-radius: 8px; 
    background: #1e1e1e; 
    color: white; 
    text-align: center; 
}

#char-name::placeholder { 
    color: #666; 
}

.gender-select { 
    display: flex; 
    gap: 15px; 
    margin: 30px 0; 
}

.gender-btn { 
    flex: 1; 
    padding: 20px; 
    font-size: 18px; 
    border: 2px solid #555; 
    border-radius: 10px; 
    background: #333; 
    color: white; 
    cursor: pointer; 
    transition: 0.2s; 
}

.gender-btn:hover { 
    border-color: #667eea; 
    background: #444; 
}

.gender-btn.active { 
    border-color: #667eea; 
    background: #667eea; 
}

.btn-start { 
    width: 100%; 
    padding: 18px; 
    background: linear-gradient(180deg, #2ed573, #26af61); 
    border: none; 
    border-radius: 10px; 
    font-size: 20px; 
    font-weight: bold; 
    color: white; 
    cursor: pointer; 
}

.btn-start:hover { 
    opacity: 0.9; 
}

.game-screen.hidden { 
    display: none; 
}

/* TOP BAR */
.top-bar { 
    padding: 15px; 
    background: #252525; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #333; 
    flex-shrink: 0;
    height: auto;
}

.top-info { 
    display: flex; 
    flex-direction: column; 
}

#header-name { 
    font-weight: bold; 
    font-size: 18px;
    color: white;
}

.highlight { 
    color: #aaa; 
    font-size: 14px; 
}

.money-display { 
    color: #85bb65; 
    font-weight: bold; 
    font-size: 18px; 
    font-family: monospace; 
}

/* AVATAR AREA */
.character-area { 
    display: flex; 
    padding: 20px; 
    align-items: center; 
    gap: 15px; 
    background: #2a2a2a; 
    border-bottom: 1px solid #333; 
    flex-shrink: 0;
    height: auto;
}

.avatar-circle { 
    width: 80px; 
    height: 80px; 
    background: #333; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 50px; 
    border: 3px solid #444; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
    flex-shrink: 0;
}

.status-bars { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}

.bar-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.icon { 
    font-size: 14px; 
    width: 20px; 
    text-align: center; 
}

.track { 
    flex-grow: 1; 
    height: 10px; 
    background: #444; 
    border-radius: 5px; 
    overflow: hidden; 
}

.fill { 
    height: 100%; 
    width: 50%; 
    transition: width 0.5s ease; 
}

.red { background: #ff4757; } 
.orange { background: #ffa502; } 
.blue { background: #1e90ff; } 
.purple { background: #a55eea; }

/* LOG - CRITICAL FIX */
.game-log { 
    flex: 1; 
    overflow-y: auto; 
    overflow-x: hidden; 
    padding: 15px; 
    background: #1e1e1e; 
    min-height: 0;
    max-height: calc(100vh - 280px);
}

.log-entry { 
    margin-bottom: 10px; 
    padding: 10px; 
    background: #252525; 
    border-radius: 8px; 
    font-size: 14px; 
    line-height: 1.4; 
    border-left: 4px solid #555; 
    animation: slideIn 0.3s;
    color: white;
}

.log-entry.bad { 
    border-left-color: #ff4757; 
}

.log-entry.good { 
    border-left-color: #2ed573; 
}

@keyframes slideIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* CONTROLS */
.controls-area { 
    padding: 10px; 
    background: #252525; 
    border-top: 1px solid #333; 
    flex-shrink: 0;
    height: auto;
}

.grid-menu { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 8px; 
    margin-bottom: 10px; 
}

.grid-menu button { 
    background: #333; 
    border: none; 
    border-radius: 8px; 
    padding: 12px; 
    color: white; 
    cursor: pointer; 
    transition: 0.1s; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 5px;
    font-size: 12px;
}

.grid-menu button:active { 
    background: #444; 
    transform: scale(0.96); 
}

.btn-icon { 
    font-size: 24px; 
}

.btn-age { 
    width: 100%; 
    background: linear-gradient(180deg, #2ed573, #26af61); 
    border: none; 
    padding: 18px; 
    border-radius: 10px; 
    font-size: 20px; 
    font-weight: bold; 
    color: white; 
    cursor: pointer; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-age:active { 
    transform: translateY(2px); 
    opacity: 0.9; 
}

/* MODALS */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.7); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 100; 
    backdrop-filter: blur(2px); 
}

.hidden { 
    display: none; 
}

.modal-box { 
    background: #2c2c2c; 
    width: 85%; 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
    text-align: center; 
    border: 1px solid #444;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-box h2 { 
    margin-top: 0; 
    color: white; 
}

.modal-box p { 
    color: #ccc; 
    margin-bottom: 20px; 
    line-height: 1.5; 
}

.modal-buttons { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

.modal-btn { 
    padding: 12px; 
    border: none; 
    border-radius: 6px; 
    font-size: 16px; 
    cursor: pointer; 
    font-weight: bold; 
}

.btn-primary { 
    background: #1e90ff; 
    color: white; 
}

.btn-danger { 
    background: #ff4757; 
    color: white; 
}

.btn-cancel { 
    background: #555; 
    color: white; 
}

