:root {
    --bg-color: #0f0f13;
    --sidebar-bg: #15151a;
    --card-bg: #1e1e24;
    --primary: #FFD700;
    --text-color: #ffffff;
    --text-muted: #888888;
    --safe-area-bottom: env(safe-area-inset-bottom);
}

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

body, html {
    margin: 0; padding: 0;
    height: 100%; width: 100%;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden; /* Chặn cuộn body tổng */
}

/* --- COMMON UTILS --- */
.app-screen {
    display: flex;
    height: 100dvh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

.app-input {
    background: #2b2b36; border: 1px solid #3f3f4e; color: white;
    border-radius: 12px; padding: 15px; width: 100%; margin-bottom: 15px; outline: none;
}
.app-input:focus { border-color: var(--primary); }

.app-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%);
    color: #000; border: none; padding: 15px; border-radius: 12px;
    font-weight: bold; width: 100%; text-transform: uppercase; cursor: pointer;
}

/* --- MOBILE FIRST (Mặc định) --- */
.sidebar { display: none; } /* Ẩn sidebar trên mobile */
.app-screen { flex-direction: column; }
.app-content {
    flex: 1; overflow-y: auto; padding: 20px;
    padding-bottom: calc(80px + var(--safe-area-bottom));
}
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #1e1e24; display: flex; justify-content: space-around;
    padding: 15px 0 calc(10px + var(--safe-area-bottom)) 0;
    border-top: 1px solid #333; z-index: 1000;
}
.nav-item {
    color: var(--text-muted); text-align: center; font-size: 10px;
    text-decoration: none; flex: 1; transition: 0.3s;
}
.nav-item i { font-size: 20px; margin-bottom: 4px; display: block; }
.nav-item.active { color: var(--primary); }
.mobile-header { display: flex; } /* Hiện header mobile */

/* --- DESKTOP / TABLET (Màn hình > 768px) --- */
@media (min-width: 768px) {
    .bottom-nav { display: none; } /* Ẩn bottom nav */
    .mobile-header { display: none !important; } /* Ẩn header mobile */
    .app-screen { flex-direction: row; }
    
    /* Sidebar đẹp cho Desktop */
    .sidebar {
        display: flex; flex-direction: column;
        width: 280px; background: var(--sidebar-bg);
        border-right: 1px solid #333; padding: 20px;
        flex-shrink: 0;
    }
    .logo-area {
        display: flex; align-items: center; gap: 15px;
        padding-bottom: 30px; margin-bottom: 20px;
        border-bottom: 1px solid #333;
    }
    .desktop-menu a {
        display: flex; align-items: center; gap: 15px;
        color: var(--text-muted); text-decoration: none;
        padding: 15px; border-radius: 10px; margin-bottom: 5px;
        font-weight: 500; transition: 0.2s;
    }
    .desktop-menu a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
    .desktop-menu a.active {
        background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
        color: var(--primary); border-left: 3px solid var(--primary);
    }
    .desktop-menu a i { width: 25px; text-align: center; }

    /* Nội dung chính Desktop */
    .app-content {
        padding: 40px;
        padding-bottom: 40px; /* Không cần chừa chỗ cho bottom nav */
        max-width: 1200px; /* Giới hạn chiều rộng cho dễ đọc */
        margin: 0 auto; width: 100%;
    }
    
    /* Grid Túi Mù trên Desktop: 4 cột thay vì 2 */
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; }
}
