:root {
    --bg-color: #050a14;
    --surface: #0f172a;
    --surface-light: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --error: #ef4444;
}

body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* --- BUTTONS --- */
button { font-family: inherit; cursor: pointer; border: none; }
.btn-primary {
    background-color: var(--primary); color: white;
    padding: 10px 20px; border-radius: 6px; font-weight: 600;
    transition: background 0.2s;
}
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary {
    background: transparent; border: 1px solid #444; color: #ccc;
    padding: 8px 16px; border-radius: 6px; margin-top: 10px;
}
.btn-secondary:hover { border-color: white; color: white; }

/* --- LAYOUT UTILS --- */
.hidden { display: none !important; }
.logo-md { width: 30px; height: 30px; margin-right: 10px; }
.logo-lg { width: 80px; margin-bottom: 20px; }

/* --- SCREENS --- */
.overlay, #auth-screen, #loader-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
}
.overlay { background: rgba(0,0,0,0.95); z-index: 9999; }
#auth-screen { background: var(--bg-color); z-index: 5000; }
#loader-screen { background: var(--bg-color); z-index: 4000; flex-direction: column; }

.modal, .auth-box {
    background: var(--surface); padding: 30px;
    border-radius: 12px; border: 1px solid #333; text-align: center;
    max-width: 400px; width: 90%;
}

.spinner {
    width: 40px; height: 40px; border: 4px solid #333;
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 15px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- APP HEADER --- */
header {
    height: 60px; background: var(--surface);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; border-bottom: 1px solid #333;
}
.brand { display: flex; align-items: center; font-weight: bold; font-size: 1.2rem; }
.actions i { margin-left: 15px; cursor: pointer; color: var(--text-muted); }
.actions i:hover { color: white; }

/* --- TABS --- */
.tabs { display: flex; background: #0b1120; border-bottom: 1px solid #333; }
.tab {
    flex: 1; padding: 15px; background: none; color: var(--text-muted);
    font-size: 1rem; transition: color 0.2s;
}
.tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.tab i { margin-right: 8px; }

/* --- CONTENT --- */
section { height: calc(100vh - 120px); overflow-y: auto; padding: 20px; box-sizing: border-box; }
.content-hidden { display: none; }
.content-active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- SOCIAL FEED --- */
.create-post-container {
    background: var(--surface); padding: 15px; border-radius: 8px;
    margin-bottom: 20px; border: 1px solid #333;
}
#post-input {
    width: 100%; height: 60px; background: var(--bg-color);
    border: 1px solid #333; color: white; padding: 10px;
    border-radius: 4px; resize: none; box-sizing: border-box;
    font-family: inherit; margin-bottom: 10px;
}
.post {
    background: var(--surface); padding: 15px; margin-bottom: 15px;
    border-radius: 8px; border: 1px solid #333;
}
.post-header { font-weight: bold; margin-bottom: 5px; color: var(--primary); }
.post-time { font-size: 0.8rem; color: #666; float: right; font-weight: normal; }

/* --- DM SYSTEM --- */
.dm-container {
    display: flex; height: 100%; border: 1px solid #333; border-radius: 8px; overflow: hidden;
}
.user-list {
    width: 30%; background: var(--surface); border-right: 1px solid #333;
    display: flex; flex-direction: column;
}
.user-item {
    padding: 15px; display: flex; align-items: center;
    cursor: pointer; border-bottom: 1px solid #222;
}
.user-item:hover { background: var(--surface-light); }
.avatar {
    width: 35px; height: 35px; background: var(--primary); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: bold; margin-right: 10px;
}
.chat-window {
    width: 70%; display: flex; flex-direction: column; background: var(--bg-color);
}
.chat-header {
    padding: 15px; background: var(--surface); border-bottom: 1px solid #333; font-weight: bold;
}
.chat-messages {
    flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.placeholder-text { color: #555; text-align: center; margin-top: 50px; }
.message-bubble {
    padding: 10px 15px; border-radius: 15px; max-width: 70%; font-size: 0.95rem;
}
.msg-me { align-self: flex-end; background: var(--primary); color: white; }
.msg-them { align-self: flex-start; background: var(--surface-light); color: var(--text); }
.chat-input-area {
    padding: 15px; background: var(--surface); display: flex; gap: 10px;
}
#message-input { flex: 1; padding: 10px; border-radius: 20px; border: none; background: #000; color: white; }
.btn-send { background: none; color: var(--primary); font-size: 1.2rem; }

/* --- GAMES --- */
.game-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px;
}
.game-card {
    background: var(--surface); padding: 25px; border-radius: 10px;
    text-align: center; cursor: pointer; border: 1px solid #333; transition: transform 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.game-card i { font-size: 2rem; color: var(--primary); }
.game-card:hover { transform: translateY(-5px); background: var(--surface-light); }

#game-frame-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: black; z-index: 6000; display: flex; flex-direction: column;
}
.game-header {
    height: 40px; background: #111; display: flex; align-items: center;
    justify-content: space-between; padding: 0 20px;
}
.close-game { background: #d32f2f; color: white; padding: 5px 15px; border-radius: 4px; }
iframe { flex: 1; border: none; }
